Q:

Print an int (integer) in C

0

Print an int (integer) in C

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.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#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

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now