Bird
0
0

What is the output of this C code?

medium📝 Predict Output Q4 of 15
C - Operators and Expressions
What is the output of this C code?
int a = 4, b = 2, c = 3;
int result = a - b * c + 5;
printf("%d", result);
A3
B15
C7
D11
Step-by-Step Solution
Solution:
  1. Step 1: Apply operator precedence

    Multiplication (*) has higher precedence, so calculate b * c = 2 * 3 = 6 first.
  2. Step 2: Evaluate the expression left to right

    Expression becomes 4 - 6 + 5 = (4 - 6) + 5 = -2 + 5 = 3.
  3. Final Answer:

    3 is printed -> Option A
  4. Quick Check:

    Multiplication first, then addition/subtraction = 3 [OK]
Quick Trick: Multiply before add or subtract [OK]
Common Mistakes:
  • Adding before multiplying
  • Ignoring operator precedence
  • Misreading the expression

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes