Program to Print an Integer


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

    /* displays output*/
    printf("You entered: %d", number);
   
    return 0;
}



-----------------------------------------
Output:

Enter an integer.....
5
You entered: 5



-----------------------------------------

  • The user is asked to enter an integer number. This number is stored in the number variable.
  • Finally, the value stored in number is displayed on the screen using printf().

Comments

Popular posts from this blog

Q: The length & breadth of a rectangle and radius of a circle are input through the keyboard. Write a program to calculate area & perimeter of the rectangle and area & circumference of the circle.

Q: If a five-digit number is input through the keyboard, write a program to calculate the sum of its digits. (Hint: Use the modulus operator ‘%’)