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
Click Here For More example in c introduction chapter
http://www.mastercaptainit.com/p/c-programming-tutorial.html
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()
.Click Here For More example in c introduction chapter
Go Back on Home Chapter By Clicking below Button :)
If above button is not working then copy the below link and paste in your address bar.http://www.mastercaptainit.com/p/c-programming-tutorial.html
No comments:
Post a Comment