INPUT OUTPUT STATEMENT PROF. SUNIL D. CHUTE HEAD DEPT OF COMPUTER SCIENCE M. G. COLLEGE ARMORI
C Input and Output  Input means to provide the program with some data to be used in the program and  Output means to display data on screen or write the data to a printer or a file. C programming language provides many built-in functions to read any given input and to display data on screen when there is a need to output the result.
scanf() and printf() functions  The standard input-output header file, named stdio.h contains the definition of the functions printf() and scanf(), which are used to display output on screen and to take input from user respectively. #include<stdio.h> void main() { // defining a variable int i; /* 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", &i); /*
 You must be wondering what is the purpose of %d inside the scanf() or printf() functions. It is known as format string and this informs the scanf() function, what type of input to expect and in printf() it is used to give a heads up to the compiler, what type of output to expect. Format String Meaning %d Scan or print an integer as signed decimal number %f Scan or print a floating point number %c To scan or print a character %s To scan or print a character string. The scanning ends at whitespace.
Input output statement
Input output statement
Input output statement
Input output statement
Input output statement
Input output statement
Input output statement
Input output statement

Input output statement

  • 1.
    INPUT OUTPUT STATEMENT PROF.SUNIL D. CHUTE HEAD DEPT OF COMPUTER SCIENCE M. G. COLLEGE ARMORI
  • 2.
    C Input andOutput  Input means to provide the program with some data to be used in the program and  Output means to display data on screen or write the data to a printer or a file. C programming language provides many built-in functions to read any given input and to display data on screen when there is a need to output the result.
  • 3.
    scanf() and printf()functions  The standard input-output header file, named stdio.h contains the definition of the functions printf() and scanf(), which are used to display output on screen and to take input from user respectively. #include<stdio.h> void main() { // defining a variable int i; /* 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", &i); /*
  • 4.
     You mustbe wondering what is the purpose of %d inside the scanf() or printf() functions. It is known as format string and this informs the scanf() function, what type of input to expect and in printf() it is used to give a heads up to the compiler, what type of output to expect. Format String Meaning %d Scan or print an integer as signed decimal number %f Scan or print a floating point number %c To scan or print a character %s To scan or print a character string. The scanning ends at whitespace.