fastread homefastrread library fastread menu

C : Print an Integer Entered by the User

Tutorial by:Manisha Dubey      Date: 2016-06-17 02:59:38

❰ Previous Next ❱

Program to Print an Integer

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

    // printf() dislpays the formatted output 
    printf("Enter an integer: ");  
    
    // scanf() reads the formatted input and stores them
    scanf("%d", &number);  
    
    // printf() displays the formatted output
    printf("You entered: %d", number);
    return 0;
}

Output

Enter a integer: 25
You entered: 25

In this program, an integer variable number is declared.

 

 
 

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.

Finally, the value stored in the variable number is displayed on the screen using printf() function.

❰ Previous Next ❱


C

Submit Your Thought, Tutorial, Articls etc.

Submit Your Information India's Number one online promotion website