Input output Integer
To work with integers in input/output, we have to use ” %d ” string formatter.
” %d ” refers to an integer.
Program
#include <stdio.h> int main() { int number; printf("Enter any number : "); scanf("%d", &number); printf("\nYour entered number : %d\n", number); return 0; }
Output
Enter any number : 10
Your entered number : 10
Explanation
The variable number is used to store, input take from user. The %d string formatter in printf and scanf function indicates that we are working with Integers, for taking input or printing some data into console we’ve to tell that we are working with Integers.
scanf()
The scanf() function reads data from console given by user. After taking input it stores the data into given variable. Here we’ve used variable named number.
printf()
The printf() function prints given message or data to console.