题解 | #衡量人体胖瘦程度#
衡量人体胖瘦程度
https://www.nowcoder.com/practice/4d604603fae94a26b59b7bc18f363bc0
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
int Weight = 0, Height = 0;
double BMI = 0;
while (scanf("%d %d", &Weight, &Height) != EOF)
{
float h = Height / 100.0;
BMI = Weight*1.0 / (h*h);
if (BMI < 18.5)
{
printf("Underweight\n");
}
else if (BMI > 27.9)
{
printf("Obese\n");
}
else if (BMI >18.5 && BMI <= 23.9)
{
printf("Normal\n");
}
else
{
printf("Overweight\n");
}
}
return 0;
}
查看10道真题和解析