Write a modular program that calculates and displays a person’s body mass index (BMI). The BMI is often used to determine whether a person is overweight or underweight for his or her height. A person’s BMI is calculated with the following formula
BMI = weight * 703/height2
Where weight is measured in pounds and height is measured in inches. The program should ask the user to enter his or her weight and height and then display the user’s BMI. The program should also display a message indicating whether the person has optimal weight, is underweight, or is overweight. A person’s weight is considered optimal if his or her BMI is between 18.5 and 25. If the BMI is less than 18.5, the person is underweight. If the BMI value is greater than 25, then the person isoverweight.
How would a Flowchart look for this?
#include <iostream>
using namespace std;
int main() {
double weight,height,bmi;
cout<<"Enter weight(in pounds) and height(in inches): ";
cin>>weight>>height;
//calculate bmi
bmi=weight*(703/(height*height));
if(bmi>=18.5 && bmi<25)
cout<<"Optimal Weight"<<endl;
else if(bmi<18.5)
cout<<"Underweight"<<endl;
else
cout<<"Overweight"<<endl;
}
Output
Flowchart
Get Answers For Free
Most questions answered within 1 hours.