program to print a integer in c

Program to Print an Integer in C

Here is a C Program to Demonstrate you how to Print an integer in C programming where a user will input an integer which is then again printed back by the program. Input is taken using a scanf and the number is printed using printf.

#include <stdio.h>
int main()
int number;
// printf() Function dislpays the output
printf("Enter an integer: ");
// scanf() aceppts input from the user
scanf("%d", &number);
printf("You entered: %d", number);
return 0;


Enter a integer: 25
You entered: 25

In this program, an integer variable number is declared.

Here in this Program,  The printf()  function displays Enter an integer: on the user’s screen. Then, the scanf() function accepts the input from the user and stores in variable numbers.

Now Finally, the value that was stored in the variable number is now displayed on the user’s screen using the  printf()function.


Anurag batra

A Tech Enthusiast who loves to work on his craft and make unique stuff From his Programming Skill at a same time Sharing that Knowledge with the outside world to help others.

Notify of
Inline Feedbacks
View all comments