C Program to Print an Integer (Entered by the User)

 In this example, the integer entered by the user is stored in a variable and printed on the screen.

To understand this example, you should have the knowledge of the following C programming topics:


  • C Variables, Constants and Literals
  • C Data Types
  • C Input Output (I/O)

 #include <stdio.h>
int main() {   
    int number;
   
    printf("Enter an integer: ");  
    
    // reads and stores input
    scanf("%d", &number);

    // displays output
    printf("You entered: %d", number);
    
    return 0;
}
Labels : #c ,#code ,

Post a Comment