I'm creating a BMI calculator with PHP and have run into some difficulties while testing. When I get a BMI equal to 18.5 it says it's underweight when it's supposed to say normal weight. I've tried many things to get the correct result but nothing works. The inputs I'm trying are Feet: 6, Inches: 5, and Pounds: 156.
$feet = $_GET['feet'];
$inches = $_GET['inches'];
$weight = $_GET['pounds'];
$height = (float) $feet * 12 + (float) $inches;
$bmi = ($weight/($height * $height)) * 703;
if ($bmi < 18.5)
$result = "Underweight";
else if ($bmi >= 18.5 && $bmi <= 24.9)
$result = "Normal weight";
else if ($bmi > 24.9 && $bmi <= 29.9)
$result = "Overweight";
else
$result = "Obese";
printf("Your Height: %u' %u\"<br>Your Weight: %u lb<br>Your BMI is %.1f you are %s",$feet,$inches,$weight,$bmi,$result);
I've tried changing the conditionals for an hour and nothing has changed. What am I doing wrong?