How to Input Integer Number!

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


#include<stdio.h>
void main ()
{
     int number;


    printf("Enter an Integer: ");
    // printf() dislpays the formatted output

    scanf("%d", &number);
    // scanf() reads the formatted input and stores them

    printf("You Entered: %d", number);
     // printf() displays the formatted output

}

Output:


 How to Work This Program :

·      1.In this program, an integer variable number is declared.
·       2 .The printf() function displays Enter an integer: on the screen. Then, the scanf()function reads an integer data from the user and stores in variable number.
·        3.Finally, the value stored in the variable number is displayed on the screen using printf()function.

*

Post a Comment (0)
Previous Post Next Post