Answer to Question #262357 in C++ for comscie

Question #262357

Write a program that calculates and displays a person’s body mass index (BMI). The BMI


is often used to determine whether a person with sedentary lifestyle 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 display a message indicating whether the person has optimal weight, is


underweight, or is overweight. A sedentary person’s weight is considered to be optimal


if his or her BMI is between 18.5 and 25. If the BMI is less than 18.5, the person is


considered to be underweight. If the BMI value is greater than 25, the person is


considered to be overweight. Use functions for this program. Implement those functions


in a separate header file.

1
Expert's answer
2021-11-07T10:12:28-0500
#include<iostream>
using namespace std;
int main(){
	double weight, height, BMI;
	cout<<"Enter weight in pounds:\n";
	cin>>weight;
	cout<<"Enter height in inches:\n";
	cin>>height;
	BMI = weight * 703  / (height * height);
	if(BMI<=18.5){
		cout<<"You are underweight.\n";
	}
	else if(BMI>18.5 && BMI<=25){
		cout<<"You weight is optimal.\n";
	}
	else{
		cout<<"You are overweight.\n";
		
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS