C printf and Scanf

Facebooktwitterredditpinterestlinkedinmailby feather

Input-Output functions in C Programming

In C Language, the printf() and scanf() are inbuilt library functions that used for input and output. It is defined in the header file“<stdio.h>”.

printf() Function:

In C programming language, printf() function is used to print the values. The values may be character, string,float,integer etc.

We can use different types of format specifier to display the value of the program.

Format Specifier Description
%d It is used to print the value of integer variable.
%s It is used to print the value of string variable.
%c It is used to print the value of single character variable.
%f It is used to print the value of float variable.
%lf It is used to print the value of double variable.
%x It is used to print the octal value of integer variable.
%o It is used to print the hexadecimal value of integer variable.
\n It is used to break the new line.

Note:  C language is the case sensitive. All characters in printf() and scanf() functions must be in lower case.

Example of printf() function:

 

scanf() Function:

In C program, scanf() function is used to read character,  string, numeric data from the keyboard.

Example:

Facebooktwitterredditpinterestlinkedinmailby feather

Leave a Comment