Bird
0
0

What will be the output of this C code?

medium📝 Predict Output Q13 of 15
C - Operators and Expressions
What will be the output of this C code?
int a = 10, b = 3;
int result = a / b;
printf("%d", result);
A3
B3.33
C4
DError
Step-by-Step Solution
Solution:
  1. Step 1: Understand integer division in C

    Dividing two integers returns an integer by dropping the decimal part.
  2. Step 2: Calculate 10 divided by 3 as integer division

    10 / 3 equals 3.33 but integer division truncates to 3.
  3. Final Answer:

    3 -> Option A
  4. Quick Check:

    Integer division truncates decimals [OK]
Quick Trick: Integer division drops decimals, result is integer [OK]
Common Mistakes:
  • Expecting decimal output with integer division
  • Confusing '/' with modulo operator
  • Assuming automatic float conversion

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes