Exercise 1 Body Mass Index (BMI) is a measure of obesity. In standard units it i
ID: 3679714 • Letter: E
Question
Exercise 1 Body Mass Index (BMI) is a measure of obesity. In standard units it is calculated by the Formula BMI 703 Which depends on the weight Win pounds, and height H in inches. The obesity classification is: BMI Classification Underweight Below 18.5 18.5 to 24.9 Normal 25 to 29.9 Overweight 30 and above Obese Write a program in C that calculates the BMI of a person. The program 1) asks the person to enter his or her weight (lb) and height (in.) 2) The program displays the result in a sentence that reads: "Your BMI value is XXX, which classifies you as SSSS," where SSSS is the corresponding classification.Explanation / Answer
#include <stdio.h>
int main(void) {
float W,H,BMI;
printf("Enter weight in pounds(lb) :");
scanf("%f",&W);
printf(" Enter height in inches(in) :");
scanf("%f",&H);
BMI = 703 * W /(H*H);
if(BMI < 18.5)
printf("Your BMI value is %f, which classifies you as Underweight",BMI);
else if(BMI < 25 )
printf("Your BMI value is %f, which classifies you as Normal",BMI);
else if(BMI < 30 )
printf("Your BMI value is %f, which classifies you as Overweight",BMI);
else
printf("Your BMI value is %f, which classifies you as Obese",BMI);
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.