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

衡量人体胖瘦程度

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

#include<stdio.h>
int main()
{
    int a,b;
    float c;
    float BMI(int weight,int high);
    while(scanf("%d%d",&a,&b)!=EOF)
    {
        getchar();
        c=BMI(a,b);
        if(c<18.5)
            printf("Underweight\n");
        if(c>=18.5&&c<=23.9)
            printf("Normal\n");
        if(c>23.9&&c<=27.9)
            printf("Overweight\n");
        if(c>27.9)
            printf("Obese\n");
    }
    return 0;
}
float BMI(int weight,int high)
{
    float d,high2;
    high2=high/100.0;
    d=weight/(high2*high2);
    return d;
}
    
                   
            


全部评论

相关推荐

11-04 10:30
已编辑
门头沟学院 研发工程师
开心小狗🐶:“直接说答案”
点赞 评论 收藏
分享
迷茫的大四🐶:价格这么低都能满了?
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务