#include <stdio.h> int main ( ) { int feet, inches, low_weight,high_weight; floa
ID: 3613727 • Letter: #
Question
#include <stdio.h>int main ( )
{
int feet, inches, low_weight,high_weight;
float height_in_inches, bmi, w, x, y, z;
printf("Please enter height in feet andinches: ");
scanf("%d %d", &feet, &inches);
printf("Please enter low weight in pounds: ");
scanf("%d", &low_weight);
printf("Please enter high weight in pounds: ");
scanf("%d", &high_weight);
z = 12.0 * feet;
height_in_inches = z + inches;
y = height_in_inches * height_in_inches;
printf("Weight BMI ");
while (low_weight <= high_weight)
{
x = low_weight / y;
bmi = 703.0 * x;
if (bmi <= 25)
{
printf("%d %f, &low_weight, &bmi not overweight ");
}
else
{
printf("%d %f, &low_weight, &bmi overweight ");
}
low_weight = low_weight + 5;
}
return 0;
}
Can somebody please take a look at this and tell me the errors? Ibelieve they are in the printf's inside the if-statement. Thanks
Explanation / Answer
/* errors are resolved but it gives bmi as zero..since you arecalculating bmi = 703.0 * x (but x is not declared so it takes bmias 0) */ #include int main ( ) { int feet, inches, low_weight,high_weight; double height_in_inches, bmi, w, x, y, z; printf("Please enter height in feet andinches: "); scanf("%d %d", &feet, &inches); printf("Please enter low weight in pounds: "); scanf("%d", &low_weight); printf("Please enter high weight in pounds: "); scanf("%d", &high_weight); z = 12.0 * feet; height_in_inches = z + inches; y = height_in_inches * height_in_inches; printf("Weight BMI "); while (low_weightRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.