input and output function in c programming

input output function in c | c programming | c coding | c language | input function c | output function c

Input..


  • In any programming language input means to feed some data into program. 
  • it can be given in the form of file or from command line.
  •  C programming language provides a set of built-in functions to read given input and feed it to the program as per requirement.


Output...


  • In any programming language output means to display some data on screen, printer or in any file.
  •  C programming language provides a set of built-in functions to output required data. 
  • Rest of the functions are given into C - Built-in Functions


printf() function



  • This is one of the most frequently used functions in C for outpput print.

             exaple for printf() function.

                   #include <stdio.h>
                          int main()
                    {
                          // printf() displays the string inside quotation
                     printf("Hello, World!");
                      return 0;
                       }

here, printf ("hello world is printing statement")

scanf() functionThis is the function which can be used to to read an input from the command li

  • include <stdio.h>
  • int main()
  • {
  • int a=0,b=0,sum=0; // declare three variables.
  • printf("Enter two numbers..." ...
  • scanf("%d%d",&a,&b); // reads two integers through keyboard.
  • sum=a+b; // calculate the sum.
  • printf("The sum is %d",sum); // prints the sum.
  • return 0;
  • }
here scanf is scaning function which is give to user no.

2 comments: