C Programming • C Basics, Operators, Loops
C Programming / Features of C — Exercises

Features of C — Exercises

Practical 2 C Basics, Operators, Loops

Write a simple C program that demonstrates the structured nature of a C program by using a separate function.

Practical / Solution

Features of C — Exercise 1

Problem

Write a simple C program that demonstrates the structured nature of a C program by using a separate function.

Program

#include <stdio.h> void display() { // function displays the message printf("C is a structured programming language.\n"); } int main() { display(); // call the function return 0; }

Explanation

The program uses a separate function named display() for a specific task. The main() function calls it. This demonstrates how a program can be divided into smaller parts.

Expected Output

C is a structured programming language.