Game Plan Fitness club requires a system that will help their members keep up to date with their BMI after each training session. The system will allow users to enter their weight and height and then calculate each member’s BMI, the system must determine their health status based on the BMI. Use the formula BMI=wieght/(height)^2 , assuming that height is entered in meters and weight is entered in kilograms. Create a function that calculate the BMI, and use a post test loop with weight of -1 to terminate the loop.
BMI Health status
Less than 18.4. Underweight
Between 18.5 and 24.9. Healthy weight Between 25.0 and 29.9. Overweight Greater than 30.0 Obesity
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
float weight, height, BMI;
while(weight!=-1)
{
cout<<"Enter Weight : ";
cin>>weight;
cout<<"Enter Height : ";
cin>>height;
BMI=weight/pow(height,2);
weight=-1;
}
if(BMI<18.4)
{
cout<<"Underweight";
}
if(BMI<=24.9 && BMI>=18.5)
{
cout<<"Healthy";
}
if(BMI<=29.9 && BMI>=25.0)
{
cout<<"Overweight";
}
if(BMI>=30)
{
cout<<"Obesity";
}
}
Comments
Leave a comment