C Program to Get Input from User

« Previous Program Next Program »

Get Input from User in C

To receive or get input from the user in C programming, use the function scanf() to scan (receive/get) user input.

C Programming Code to Get Input from User

Following C program ask to the user to enter a number to get the number entered by the user, then display the entered number on the screen

The function scanf() in C is used to scan the input data like integer, character, float, etc.

/* C Program - Get Input from User */
void main()
	char name[20];
	int num;
	printf("Enter a number : ");
	printf("You entered %d",num);

When the above c program is compile and executed, it will produce the following result:

receiving input in c programming

Same Program in Other Programming Language

You may also like same program in other programming languages:

« Previous Program Next Program »


Quick Links
Signup - Login - Give Online Test