Write a program that requests a person\'s weight and height as input and display
ID: 3532846 • Letter: W
Question
Write a program that requests a person's weight and height as input and displays theperson's body mass index.Use the function BMI to calculate the body mass index,
703 times the weight in pounds, divided by the square of the height in inches, and
then rounded to the nearest whole number.
Write a program that requests a person's weight and height as input and displays the person's body mass index.Use the function BMI to calculate the body mass index, 703 times the weight in pounds, divided by the square of the height in inches, and then rounded to the nearest whole number.
Explanation / Answer
#include<iostream>
using namespace std;
int main ()
{
double height = 0.0;
double weight = 0.0;
double bmi = 0.0;
cout << "Enter your height (in inches): ";
cin >> height;
cout << "Enter your weight (in pounds): ";
cin >> weight;
bmi = 703 * weight / (height * height);
if (bmi < 18.5)
{
cout << "Your body weight category is underweight." << endl;
}
else if (bmi = 18.5 < 25)
{
cout << "Your body weight category is normal." << endl;
}
else if (bmi = 25 < 30)
{
cout << "Your body weight category is overweight." << endl;
}
else if (bmi >= 30)
{
cout << "Your body weight category is obese." << endl;
}
system ("pause");
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.