What is the result of the expression 8 % 4 in C?
A. 0
B. 4
C. 2
D. 8
Answer: Option A
Solution(By Examveda Team)
In C, the % (modulo) operator is used to calculate the remainder when one number is divided by another. In the expression 8 % 4, it calculates the remainder of dividing 8 by 4, which is 0.Option B (4) is incorrect because it doesn't represent the remainder of the division.
Option C (2) is incorrect because it also doesn't represent the remainder; it represents half of the dividend.
Option D (8) is incorrect because it's the dividend itself, not the remainder of the division.
Related Questions on Operators and Expressions
What does the ++ operator do in C when applied to a variable?
A. Decrements by 1
B. Adds 1
C. Doubles the value
D. Leaves it unchanged
Join The Discussion