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: 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 ‘%’)

Q: If value of an angle is input through the keyboard, write a program to print all its Trigonometric ratios.