Banner Header

Saturday 26 August 2017

C Program to Print an Integer By User

C Program to Print an Integer By User

In this program, integer take by user is stored in a variable. Then, that variable is displayed on the screen using printf() function.

print an integer

Program to Print an Integer


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

    // printf() dislpays the formatted output 
    printf("Enter an integer:\n ");  
    
    // 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.

Click on the download button to download file

 Download Button



C Program to Print an Integer By User Reviewed by Waqas Ahmed Mir PC on August 26, 2017 Rating: 5 C Program to Print an Integer By User In this program, integer take by user is stored in a variable. Then, that variable is displayed on the...

No comments: