ProgrammingVery hard

printf("%+d %05.1f", 5, 3.14159); What is printed?

  1. A. 5 003.2
  2. B. +5 3.1
  3. C. +5 003.1
  4. D. +5 003.14

Correct answer: C. +5 003.1

The + flag prints the sign, and %05.1f gives one decimal place with zero padding to width five, so 003.1.

More C Programming questions

Exams that ask this topic