- printf() and scanf() are the library functions defined in stdio.h header file.
- if we are using printf and scanf in our program we should use stdio.h header file.
printf()
- printf() function is used to print the “character, string, float, integer, octal and hexadecimal values” onto the output screen.
Symbol and its functions
Symbol |
Function |
%d |
Prints Integer |
%f |
Prints float and double |
%c |
Prints Character |
%s |
Prints String |
%o |
Prints Octal Value |
%u |
Prints unsigned integer |
%x |
Prints hexadecimal value |
c program to print "hello world"
#include<stdio.h>
main(){
printf("hello world");
}
Output: hello-world
scanf()
- scanf() function is used to input the “character, string, float, integer, octal and hexadecimal values” from the keyboard.