题解 | #衡量人体胖瘦程度#

衡量人体胖瘦程度

http://www.nowcoder.com/practice/4d604603fae94a26b59b7bc18f363bc0

#include<stdio.h> #include<string.h> int main() { float weight , height , b , bmi(int , int); while(scanf("%f %f", &weight,&height) != EOF) { b = bmi(weight , height); if(b < 18.5) puts("Underweight"); if(b >= 18.5 && b <= 23.9) puts("Normal"); if(b > 23.9 && b <= 27.9) puts("Overweight"); if(b > 27.9) puts("Obese"); }

} float bmi(int weight , int height) { float d,high2; high2=height/100.0; d=weight/(high2*high2); return d; return weight / (height * height); }

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务