How to print an integer in C language? A user inputs an integer, and we print it. Input is done using scanf function, and the number is printed on screen using printf.
#include <stdio.h> int main() { int a; printf("Enter an integer\n"); scanf("%d", &a); printf("The integer is: %d\n", a); return 0; }
output:
Enter an integer
2
The integer is: 2
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
output:
Enter an integer
2
The integer is: 2
need an explanation for this answer? contact us directly to get an explanation for this answer