Skip to content
Question Bank (3 marks) · Q20

Q.How does the monitor display 321 for statement

(i) printf(“%d”, x)?
(ii) printf(“%04d”, x)?
Karnataka PUCTextbookShort· 3mImportance★★★★★est
64% · 99/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 x = 321, %d prints 321 and %04d prints 0321.

The format specifier controls how the integer x = 321 is displayed:

(i) printf("%d", x) - %d prints the integer using exactly as many columns as it needs, so the output is:

321
``` …

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.