Write a C program to print an integer

To start programming in c the first thing student learn is to write a C program to print an integer. To do this first an integer variable is declared. Then the scanf() function is used to read the number entered by user and store it in an integer variable. Finally, printf() function is used to display the stored integer variable on the screen. Here is the program:

#include
#include
void main()
{
    clrscr();
    int num;
    printf("Enter an integer number: ");  
    scanf("%d", &num);  
    printf("You entered: %d", num);
    getch();
}

Examples

c program to print an integer