Examveda
Examveda

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

A. 2

B. 2.5

C. 2.0

D. 3

Answer: Option B

Solution(By Examveda Team)

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.

This Question Belongs to C Program >> Operators And Expressions

Join The Discussion

Related Questions on Operators and Expressions