printf("%d", variableOfIntType);​
// Integer value
#include
int main()
{
// Declaring integer
int x = 5;
// Printing values
printf("Printing Integer value %d", x);
return 0;
}
Printing Integer value 5
scanf()
method. The scanf()
method, in C, reads the value from the console as per the type specified. scanf()
method becomes as follows then: scanf("%d", &variableOfIntType);​
// C program to take an integer
// as input and print it
#include
int main()
{
// Declare the variables
int num;
// Input the integer
printf("Enter the integer: ");
scanf("%d", &num);
// Display the integer
printf("Entered integer is: %d", num);
return 0;
}
Enter the integer : 10
Entered integer is : 10