What is the result of the expression 2.5 + 2 in C?
A. 4.5
B. 4
C. 2.7
D. 2
Answer: Option A
Solution(By Examveda Team)
In C, when you add two floating-point numbers, as in the expression 2.5 + 2, the result is a floating-point number. Therefore, the result is 4.5.Option B (4) is incorrect because it represents an integer result, but the expression involves floating-point numbers.
Option C (2.7) is incorrect; it's not the result of the given expression.
Option D (2) is incorrect for the same reason as Option B; it represents an integer result, not a floating-point result.
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