Bird
0
0

What will this C code print?

medium📝 Predict Output Q5 of 15
C - Loops
What will this C code print?
for(int i = 0; i < 3; i++) {
    printf("%d", i);
}
A012
B123
C321
D0 1 2
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the for loop range

    i starts at 0, runs while less than 3, so values are 0,1,2.
  2. Step 2: Check the print format

    printf prints numbers without spaces, so output is "012".
  3. Final Answer:

    012 -> Option A
  4. Quick Check:

    For loop prints 0,1,2 without spaces [OK]
Quick Trick: For loops run from start to less than end value [OK]
Common Mistakes:
  • Adding spaces in output
  • Starting from 1
  • Printing in reverse order

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes