Vidyalelo
C Programming · Q21

Operators and Expressions

Programming · C Programming · question 21

Q21

What is the result of the expression (10 + 2) / 2 in C?

A.
12
B.
6
Answer
C.
7
D.
11

Answer: Option B

Solution

Answer: Option B
Solution:
In C, arithmetic expressions follow the order of operations (PEMDAS/BODMAS), where parentheses have the highest precedence. Therefore, the expression (10 + 2) is evaluated first, resulting in 12. Then, the division by 2 is performed, resulting in 12 / 2, which equals 6.

Option A (12) is incorrect because it represents the result of the expression inside the parentheses without considering the subsequent division.
Option C (7) is incorrect because it does not represent the correct result of the expression.
Option D (11) is incorrect because it doesn't consider the division by 2;