Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
73 views

C Programming - Program To Print A Integer Entered by A User

The program asks the user to enter an integer, stores the input in a variable num, and prints out the entered integer. It demonstrates how to take user input using scanf() and print output using printf() in C programming.

Uploaded by

R-jayVenturillo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

C Programming - Program To Print A Integer Entered by A User

The program asks the user to enter an integer, stores the input in a variable num, and prints out the entered integer. It demonstrates how to take user input using scanf() and print output using printf() in C programming.

Uploaded by

R-jayVenturillo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

C Program to Print a Integer Entered

by a User
Source Code
#include <stdio.h>
int main()
{
int num;
printf("Enter a integer: ");
scanf("%d",&num); /* Storing a integer entered by user in variable num */
printf("You entered: %d",num);
return 0;
}
Output
Enter a integer: 25
You entered: 25
Explanation
In this program, a variable num is declared of type integer using keyword int .
Then, printf() function prints the content inside quotation mark which is "Enter a integer: ".
Then, the scanf() takes integer value from user and stores it in variable num. Finally, the value
entered by user is displayed in the screen using printf() . Learn more
about how printf() and scanf() works in C programming.

You might also like