题解 | #判断身材状态#
判断身材状态
https://www.nowcoder.com/practice/6f4afb0f8be64d5eaf65a205b8584888
#include <iostream> #include <math.h> using namespace std; int main() { double weight; double height; double bmi; cin >> weight; cin >> height; height=pow(height,2);//平方 bmi=weight/height; if (bmi<18.5) { printf("偏瘦"); } else if (bmi>=18.5 && bmi<20.9) { printf("苗条"); } else if (bmi>=20.9 && bmi<=24.9) { printf("适中"); } else if (bmi>24.9) { printf("偏胖"); } return 0; }