Bird
0
0

What will be the output of this C code?

medium📝 Predict Output Q4 of 15
C - Basics and Execution Environment
What will be the output of this C code?
#include <stdio.h>
int main() {
    int a = 5;
    int b = 3;
    printf("%d", a + b);
    return 0;
}
AError
B53
C8
D0
Step-by-Step Solution
Solution:
  1. Step 1: Analyze variable values and operation

    a is 5, b is 3, and the code adds them.
  2. Step 2: Calculate the sum and output

    5 + 3 equals 8, so printf prints 8.
  3. Final Answer:

    8 -> Option C
  4. Quick Check:

    Output of addition = 8 [OK]
Quick Trick: Addition prints sum, not concatenation [OK]
Common Mistakes:
  • Thinking printf concatenates numbers
  • Expecting error due to syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes