Getting input in C
Getting input in C There are two ways to get input from user in C language. 1) By scanf() function 2) By gets() or fgets() function 1. By scanf() function:- The standard input-output header file named stdio.h contains the definition of the function printf() and scanf(), which are used to display on the screen and to take input from user. Program:- #include < stdio . h > void main ( ) { // defining a variable int x ; /* displaying message on the screen asking the user to input a value */ printf ( "Please enter a value..." ) ; /* reading the value entered by the user */ scanf ( "%d" , &x ) ; /* displaying the number as output */ printf ( "\nYou entered: %d" , x ) ; } Output:- Please enter a value... The Output was aski...