This:
18.5<=bmi<23
means the same as
(18.5 <= bmi) < 23
In other words the value of bmi
is never compared to 23
. You must not use that kind of math-syntax in C, it should be written as:
(18.5 <= bmi) && (bmi < 23)
So it's really two comparisons of the variable, and must be written using the boolean-and (&&
) operator to make this explicit.