Write a program to calculate and display a person’s Body Mass Index (BMI). BMI i
ID: 3763140 • Letter: W
Question
Write a program to calculate and display a person’s Body Mass Index (BMI).
BMI is an internationally used measure of obesity. Depending on where you live,
either use the Imperial BMI formula or the Metric Imperial Formula. Once the
BMI is calculated, display a message of the person’s status. Prompt the user for
both their weight and height. The BMI status categories, as recognized by the
U.S. Department of Health & Human Services, are shown in the table below:
BMI Weight Status
Below 18.5 Underweight
18.5 - 24.9 Normal
25 - 29.9 Overweight
30 & above Obese
Explanation / Answer
#include<iostream>
using namespace std;
int main()
{
double weight,height;
cout << "Enter your weight(kg) : ";
cin >> weight;
cout << "Enter your height(cm) : ";
cin >> height;
height = height/100; //converting to metes
double bmi = weight/(height*height);
if(bmi<18.5)
cout << "Under-Weight." << endl;
else if (bmi>=18.5 && bmi<=24.9)
cout << "Normal." << endl;
else if (bmi>=25 && bmi<=29.9)
cout << "Over-Weight." << endl;
else if (bmi>=30)
cout << "Obese." << endl;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.