题解 | #衡量人体胖瘦程度#
衡量人体胖瘦程度
http://www.nowcoder.com/practice/4d604603fae94a26b59b7bc18f363bc0
#include <stdio.h>
int main() { int x = 0; int y = 0; double a = 0; double b = 0;
while (scanf("%d %d", &x, &y) != EOF)
{
b = y / 100.0;
a = x*1.0 / (b*b);
if (a < 18.5)
printf("Underweight\n");
else if (a > 27.9)
printf("Obese\n");
else if (a>=18.5 && a<=23.9)
printf("Normal\n");
else
printf("Overweight\n");
}
return 0;
}