0
点赞
收藏
分享

微信扫一扫

三个和尚比身高

艾米吖 2022-02-23 阅读 57
javaeclipse

package scannerTest.java;

import java.util.Scanner;

public class scannerTest {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入第一个和尚的身高:");
        int height1=sc.nextInt();
        System.out.println("请输入第二个和尚的身高:");
        int height2=sc.nextInt();
        System.out.println("请输入第三个和尚的身高:");
        int height3=sc.nextInt();
        int tempHeight=height1>height2?height1:height2;
        int maxHeight=tempHeight>height3?tempHeight:height3;
        System.out.println("这三个和尚中最高的是:" +maxHeight+"cm");
    }

}
 

举报

相关推荐

0 条评论