#include <stdio.h>
int main() {
int weight = 0, height = 0;
float BMI = 0.0;
//循环读入体重和身高
while(scanf("%d %d", &weight, &height) != EOF) {
//根据公式计算BMI
BMI = weight / (height/100.0 * height/100.0);
//使用if else嵌套判断BMI所在的区间,输出即可
if(BMI < 18.5)
printf("Underweight\n");
else if(BMI >=18.5 && BMI <= 23.9)
printf("Normal\n");
else if(BMI > 23.9 && BMI <= 27.9)
printf("Overweight\n");
else
printf("Obese\n");
}
return 0;
}
衡量人体胖瘦程度
最新推荐文章于 2024-09-13 21:36:15 发布