Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using the conditions below, write three programs that accept the weight of a per

ID: 3810682 • Letter: U

Question

Using the conditions below, write three programs that accept the weight of a person in pounds and the height of a person in inches. Convert the weight and height into Body Mass Index (BMI). The formula for converting weight into BMI is as follows: BMI = Weight * 703/Height^2 You must display the BMI for 3 people, one at a time. In other words, display the BMI for person 1 before asking for the next person's information. You must use the following loops to complete this task. a) Using a while loop Show Me:_ b) Using a for loop Show Me:_ c) Using a do while loop Show Me:_

Explanation / Answer

#include <stdio.h>

float calculateBMI(float weight,float height) {
  
float BMI = (weight*703)/(height*height) ;
  
return BMI;
}
int main()
{
float weight,height,BMI;

int i=1;
  
while(i<4) {
  
printf("Enter the weight of person%d in pounds:",i);
scanf("%f",&weight);
  
printf("Enter the height of person%d in inches:",i);
scanf("%f",&height);
  
BMI = calculateBMI(weight,height);
  
printf("Person %d BMI : %f ",i,BMI);
i= i + 1;
}
  
for(i=1; i<4; i++) {

printf("Enter the weight of person%d in pounds:",i);
scanf("%f",&weight);
  
printf("Enter the height of person%d in inches:",i);
scanf("%f",&height);
  
BMI = calculateBMI(weight,height);
  
printf("Person %d BMI : %f ",i,BMI);
}
i = 1;
do {

printf("Enter the weight of person%d in pounds:",i);
scanf("%f",&weight);
  
printf("Enter the height of person%d in inches:",i);
scanf("%f",&height);
  
BMI = calculateBMI(weight,height);
  
printf("Person %d BMI : %f ",i,BMI);
i= i + 1;

} while(i<4);
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote