Bird
0
0

Identify the error in this code:

medium📝 Debug Q7 of 15
C - Operators and Expressions
Identify the error in this code:
int a = 10;
int b = 0;
int c = a / b;
printf("%d", c);
ADivision by zero error
BMissing variable declaration
CIncorrect printf format specifier
DNo error, output is 0
Step-by-Step Solution
Solution:
  1. Step 1: Analyze division operation

    Dividing by zero is undefined and causes runtime error in C.
  2. Step 2: Understand program behavior

    This will cause a crash or exception, not a valid output.
  3. Final Answer:

    Division by zero error -> Option A
  4. Quick Check:

    Division by zero = runtime error [OK]
Quick Trick: Never divide by zero; it causes errors [OK]
Common Mistakes:
  • Ignoring division by zero
  • Assuming output is zero
  • Wrong printf usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes