Vidyalelo
C Programming · Q15

Operators and Expressions

Programming · C Programming · question 15

Q15

What is the result of the expression 10 / 0 in C?

A.
0
B.
Infinity
C.
Compilation error
D.
Runtime error
Answer

Answer: Option D

Solution

Answer: Option D
Solution:
In C, dividing a number by zero is undefined and leads to a runtime error. The expression 10 / 0 will result in a runtime error because dividing by zero is not allowed in mathematics or in C programming.

Option A (0) is incorrect because dividing by zero does not result in zero; it is undefined.
Option B (Infinity) is not the result in C programming when you divide by zero; it depends on the context and compiler.
Option C (Compilation error) typically does not occur because the error is detected at runtime, not during compilation.