#include <iostream>
using namespace std;
int main()
{
// first user prompt
cout << "Please, print a weight
(in pounds)" << endl;
// reading a weight
double pounds;
cin >> pounds;
// second user prompt
cout << "Please, print a height
(in inches)" << endl;
// reading a height
double inches;
cin >> inches;
// calculating bmi
double kilos = pounds * 0.453592;
double meters = inches * 0.0254;
double bmi =
kilos / (meters *meters);
cout << "Your BMI is " << bmi << endl;
// calculating bmi interpretation
if (bmi < 16)
cout << "Seriously underweight" << endl;
else if (16 <= bmi && bmi < 18)
cout << "Underweight" << endl;
else if (18 <= bmi && bmi < 24)
cout << "Normal weight" << endl;
else if (24 <= bmi && bmi < 29)
cout << "Overweight" << endl;
else if (29 <= bmi && bmi < 35)
cout << "Seriously overweight"
<< endl;
else
cout << "Gravely overweight"
<< endl;
/*
Example:
Please, print a weight (in pounds)
176
Please, print a height (in inches)
70
Your BMI is 25.2531
Overweight
*/
}
Comments
Leave a comment