Answer to Question #206539 in C++ for Jaskaran Singh

Question #206539

Design a program that calculates a person’s body mass index (BMI).

BMI is often used to determine whether a person with a sedentary

lifestyle is overweight or underweight for his or her height. A person’s

BMI is calculated with the following formula:

In the formula, weight is measured in pounds and height is measured in

inches. Enhance the program so it displays 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


1
Expert's answer
2021-06-14T03:00:44-0400
#include <iostream>
using namespace std;


int main() {
    float wieght = 100, height = 50;
	std::cout << "This program calculates the BMI." << std::endl;
	std::cout << "Enter the wieght (in lbs): " << std::endl;
	std::cin >> wieght;
	std::cout << "Enter the height (in inches): " << std::endl;
	std::cin >> height;
	
	float BMI = 703*wieght/(height*height);
	cout<<"BMI of the person is: "<<BMI<<"\n";
	
	if(BMI >= 18.5 && BMI <= 25){
	    std::cout << "Weight of the person is optimal." << std::endl;
	}
	else  if(BMI < 18.5){
	    std::cout << "Person is underweight." << std::endl;
	}
	else if(BMI > 25){
	    std::cout << "Person is overweight." << std::endl;
	}
	return 0;
}

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