题解 | 判断体重指数

判断体重指数

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

import java.util.*;
class Main 
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        double weightPoint;
        double height = sc.nextDouble();
        double weight = sc.nextDouble();
        weightPoint = weight/(height*height);
        System.out.print(
            weightPoint<18.5?"偏瘦" : weightPoint<20.9
            ?"苗条" : weightPoint<24.9
            ?"适中" : "偏胖"
        );
    }    
}

全部评论

相关推荐

投递网易等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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