Write a C program to take an integer number from user and print it on screen.
C Input/Output, C Variables, C Datatypes
- We have declared variable 'num' of type 'int' to hold the value of number entered by user.
- Then we display helper message "Enter an integer number:" to user using printf() library function.
- To read number from user we use scanf() library function. Here '%d' indicates that we are reading decimal/integer number. Do note that in scanf() we pass address of variable. i.e. &num
- To print the read value we use printf(). Things to note here is in printf() we use name of variable as it is i.e. num
Step by Step Walk-through of Program: