Bird
0
0

What is the output of the following code?

medium📝 Predict Output Q13 of 15
C - Operators and Expressions
What is the output of the following code?
int a = 10;
a += 5;
a -= 3;
printf("%d", a);
A8
B15
C12
D10
Step-by-Step Solution
Solution:
  1. Step 1: Calculate after first operation 'a += 5;'

    Starting with a = 10, adding 5 gives a = 15.
  2. Step 2: Calculate after second operation 'a -= 3;'

    Subtracting 3 from 15 gives a = 12.
  3. Final Answer:

    12 -> Option C
  4. Quick Check:

    10 + 5 - 3 = 12 [OK]
Quick Trick: Apply each operator step-by-step to track value [OK]
Common Mistakes:
  • Adding and subtracting in wrong order
  • Confusing '+=' and '-=' effects
  • Ignoring initial value of variable

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes