I am trying to calculate Body mass index and body weight category based on height and weight. The BMI works but it always gives me "underweight" for some reason. Ay help is much appreciated!
Code:
#include <iostream>
using namespace std;
int main()
{
double hgt=0;
double wgt=0;
double BodyMI=0;
{
cout<<"Enter Height"<<endl;
cin>>hgt;
cout<<"Enter Weight"<<endl;
cin>>wgt;
}
if(BodyMI<=18.4)
{
BodyMI=703 * wgt / (hgt * hgt);
cout<<"BMI:"<<BodyMI<<endl;
cout<<"Body Weight Category:Underweight"<<endl;
}
else if(BodyMI>=18.5 && BodyMI<=24)
{
BodyMI=703 * wgt / (hgt * hgt);
cout<<"BMI:"<<BodyMI<<endl;
cout<<"Body Weight Category:Normal"<<endl;
}
else if(BodyMI>=25&&BodyMI<=29)
{
BodyMI=703 * wgt / (hgt * hgt);
cout<<"BMI:"<<BodyMI<<endl;
cout<<"Body Weight Category:Overweight"<<endl;
}
else if(BodyMI>=30)
{
BodyMI=703 * wgt / (hgt * hgt);
cout<<"BMI:"<<BodyMI<<endl;
cout<<"Body Weight Category:Obese"<<endl;
}
system("pause");
return 0;
}