0

Source Code


#include <stdio.h>
int main()
{
int num;
printf
("Enter a integer: ");
scanf
("%d",&num); /* Storing a integer entered by user in variable num */
printf
("You entered: %d",num);
return 0;
}

Output

Enter a integer: 25
You entered: 25

Explanation

In this program, a variable num is declared of type integer using keyword int. Then, printf() function prints the content inside quotation mark which is "Enter a integer: ". Then, the scanf() takes integer value from user and stores it in variable num. Finally, the value entered by user is displayed in the screen using printf(). Learn more about how printf() and scanf() works in C programming.



Post a Comment

 
Top