Input and Output in C

Input and Output in C

Input and Output in C

Input and output in c, is to take input from user at runtime and output means to print the output to the output screen.

Standard I/O Library function

Input:- It is a process to take a user input while executing any program.

Output:- It is process of printing the statement to the output screen.

Formatted output in c

It is process where it takes text or value within program and print it on to the output screen. printf is function which mainly used to print the text or value of variable to the screen.

Example :-  print(“Technical seek”);

In above example we want to print Technical seek statement to the output screen to do this we use printf function in this function we put statement which we want to print in doubt quotes. The printf function interprets compiler to print the text to screen and semicolon ; at the end indicates the end of the statement.

Formatted input in c

It is a process,where we enter the input at runtime and which value is stored to the variable. scanf function which is used to take the input from user to the variable.

  Example:-

string name;

 printf(“Enter name”);

 scanf(“%s”,&name);

In above example,we taken the input from user the value name and stored that name to variable name. scanf function which is used to take the input from used in this function we specify the type of which we taking input (there are different notation to specify type of which we taking input .for integer type we write %d ,for float %f, for string %s etc). After, &name indicates to taken value to be stored yo variable name.

character Input and output

  • getchar() :- The getchar () function is used to take the input character from user.
  • putchar() :- The purchase() function is used to print character to output screen.

Input and Output in C

Leave a Comment

Your email address will not be published.