Skip to content
Question Bank (3 marks) · Q21

Q.How does the monitor display 28.689 for a statement

(i) printf(“%5.3f”, p)?
(ii) printf(“%e”, y)?
Karnataka PUCTextbookShort· 3mImportance★★★★★est
67% · 103/154 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

[!TLDR]

For 28.689, %5.3f prints 28.689 and %e prints 2.868900e+01.

The value 28.689 is displayed according to the specifier:

(i) printf("%5.3f", p) - .3 fixes 3 digits after the decimal point and the field width 5 is the minimum total width. The number 28.689 already needs 6 columns, which is more than 5, so no extra spaces are added:

28.689
``` …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.