printf() is used to print the values on the screen. To print certain values, and on the other hand, scanf() is used to scan the values. We need an appropriate datatype format specifier for both printing and scanning purposes. For example,
- %d: It is a datatype format specifier used to print and scan an integer value.
- %s: It is a datatype format specifier used to print and scan a string.
- %c: It is a datatype format specifier used to display and scan a character value.
- %f: It is a datatype format specifier used to display and scan a float value.