What is the result of the expression 5 / 2.0 in C?

What is the result of the expression 5 / 2.0 in C? Correct Answer 2.5

In C, when you divide an integer by a floating-point number, the result is a floating-point number. In this expression, 5 is an integer, and 2.0 is a floating-point number. When you perform the division, 5 / 2.0, it results in 2.5.

Option A (2) is incorrect because it represents an integer result, but the expression involves a floating-point division.
Option C (2.0) is also incorrect because it represents the result as a floating-point number, but the correct result is 2.5.
Option D (3) is incorrect because it doesn't consider the decimal part of the result; the correct result is 2.5.

Related Questions