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: Two number are input through the keyboard into two two locations C and D. write a program to interchange the contents of C and D.

Q: Consider a currency system in which there are note of seven denominations, namely, Rs. 1, Rs. 2, Rs. 5, Rs. 10, Rs. 50, Rs. 100. if a sum of Rs. N is entered through the keyboard, write a program to compute the smallest number of notes that will combine to give Rs N.