Would somebody mind taking a look at this to see if there are anyblatant errors?
ID: 3613868 • Letter: W
Question
Would somebody mind taking a look at this to see if there are anyblatant errors? I can't get the output right in the program- itwon't return to the for loop and increment the height by threeinches. Output should look like this:Height Weight BMI
5 0 110 somefloat not overweight
5 0 120 " not overweight
5 0 130 " overweight
5 3 110 " not overweight
5 3 120 " not overweight
etc.
Thanks
int main ( )
{
int low_height, high_height,low_weight, high_weight, feet, inches;
float height_in_inches, bmi, x, y, z, i;
printf("Please enter a low height in feet: ");
scanf("%d", &low_height);
printf("Please enter a high height in feet: ");
scanf("%d", &high_height);
printf("Please enter a low weight in pounds: ");
scanf("%d", &low_weight);
printf("Please enter a high weight inpounds: ");
scanf("%d", &high_weight);
printf("HeightWeight BMI ");
for (i = low_height * 12.0; i <= high_height *12.0; i = i + 3.0)
{
while(low_weight <= high_weight)
{
x = i * i;
y = low_weight / x;
bmi = 703.0 * y;
feet = i / 12;
inches = i - low_height *12;
if(bmi <= 25.0)
{
printf("%d%d %d %.4f not overweight ",
feet, inches, low_weight, bmi);
}
else
{
printf("%d%d %d %.4f overweight ",
feet, inches, low_weight, bmi);
}
low_weight = low_weight + 10;
}
}
return 0;
}
Explanation / Answer
please rate - thanks see red you were destroyinglow weight #include #include int main ( ) { int low_height, high_height,low_weight, high_weight, feet, inches; int initial_weight; float height_in_inches, bmi, x, y, z, i; printf("Please enter a low height in feet: "); scanf("%d", &low_height); printf("Please enter a high height in feet: "); scanf("%d", &high_height); printf("Please enter a low weight in pounds: "); scanf("%d", &low_weight); initial_weight=low_weight; printf("Please enter a high weight inpounds: "); scanf("%d", &high_weight); printf("HeightWeight BMI "); for (i = low_height * 12.0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.