题解 | #判断身材状态#
判断身材状态
http://www.nowcoder.com/practice/6f4afb0f8be64d5eaf65a205b8584888
#include using namespace std;
int main() {
double weight;
double height;
cin >> weight;
cin >> height;
double bmi=weight/(height*height);
if(bmi>24.9)
{
cout<<"偏胖"<<endl;
}
else if(bmi>20.9)//这儿其实只要是满足大于20.9就可以,因为在执行时是按照顺序结构来进行执行;
{
cout<<"适中"<<endl;
}
else if(bmi>18.5)
{
cout<<"苗条"<<endl;
}
else
{
cout<<"偏瘦"<<endl;
}
return 0;
}