printf: formatted output
printf displays values on standard output, usually the screen. A format specifier tells it how to display each value. For example, printf("Age = %d", age); displays an integer. For price = 12.5, printf("%.2f", price); displays 12.50. Here .2 requests two digits after the decimal point. It changes the displayed form, not the stored value.
Related exam questions
Topic matches from the supplied JNTUH papers. Marks below are the printed allocations for those questions.
- March/April 2023 · Q3(b) · 5 marks
Distinguish formatted and unformatted input/output statements.
Paper P07 · page 1 - September 2023 · Q2(a) · 3 marks
Explain stdin, stdout and stderr with examples.
Paper P09 · page 1
View all matching exam references →