题解 | #判断体重指数#

判断体重指数

https://www.nowcoder.com/practice/688f96cc38bb4a76996698d2f987b1b5

继续if else判断 在运用逻辑运算

    double heightin.nextDouble();

            double weightin.nextDouble();

            double bodx = weight / (height * height); 

            if ( bodx < 18.5){

                System.out.println("偏瘦");

            }else if (bodx >= 18.5 && bodx < 20.9){

                System.out.println("苗条");

            }else if (bodx >= 20.9 && bodx < 24.9){

                System.out.println("适中");

            }

            if (bodx >= 24.9){

                System.out.println("偏胖");

            }

全部评论

相关推荐

2025-12-17 17:15
华东师范大学 运营
点赞 评论 收藏
分享
2025-12-08 19:24
电子科技大学 Java
苗条的伊泽瑞尔最喜欢...:同28届被压力了,电科✌就不能去卷算法吗?把Java留给我们双非卷
投递快手等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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