Bird
0
0

What will be the output of this code?

medium📝 Predict Output Q13 of 15
C - onditional Statements
What will be the output of this code?
int x = 5;
if (x > 3) {
    printf("Yes");
} else {
    printf("No");
}
AYes
BNo
CError
DNo output
Step-by-Step Solution
Solution:
  1. Step 1: Evaluate the condition x > 3

    Since x is 5, 5 > 3 is true.
  2. Step 2: Determine which block runs

    The if block runs and prints "Yes" because the condition is true.
  3. Final Answer:

    Yes -> Option A
  4. Quick Check:

    5 > 3 is true, prints Yes [OK]
Quick Trick: If condition true, prints inside if block [OK]
Common Mistakes:
  • Confusing else block execution
  • Assuming syntax error without checking code
  • Ignoring condition evaluation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes