top of page

C Programming Examples



C Programs


C programs with output showing operator use, loops, functions, lists, string operations, documents, pointers appearing. Install and execute executable documents, without compiling the source file. Code:: IDE blocks are used to write down programs, most of which are paintings with compilers from GCC and Dev C++.


The high-quality way of evaluating C programming is through example practice. The page bears examples of basic C programming concepts. You are recommended to use these examples to include references and check them on your own.

The first program "Hello World" prints.


C Programming Examples with Output


Example 1 - C hello world program /** My first C program */

#include <stdio.h> int main() { printf("Hello World\n"); return 0; }

Output of program: "Hello World"


Example 2 - using if else control instructions

#include <stdio.h> int main() { int n; printf("Enter a number\n"); scanf("%d", &n); if (n > 0) printf("Greater than zero.\n"); else printf("Less than or equal to zero.\n"); return 0; }

Output: Enter a number -45 Less than or equal to zero.


Read More...

Comments


bottom of page