16 < bmi <= 18.5
doesn't do what you think it does, for example. (Although it compiles, it actually gets evaluated as (16 < bmi) <= 18.5
and the bit in parentheses is either 1 (true) or 0 (false).)
You need to write 16 < bmi && bmi <= 18.5
.
But if you order your bmi limits, you don't need to repeatedly test the lower bound.