Java比大小
//7.20 三个和尚比身高
import java.util.Scanner; //导包
public class Hello{
public static void main(String[] args){
System.out.println("请输入第一个和尚的身高:");
int height1,height2,height3;
Scanner Jin=new Scanner(System.in); //新建
height1=Jin.nextInt();
System.out.println("请输入第二个和尚的身高:");
height2=Jin.nextInt();
System.out.println("请输入第三个和尚的身高:");
height3=Jin.nextInt();
int temp;
int MAX;
//比大小
if(height1>height2)
{
temp=height1;
}
else
temp=height2;
if(temp>height3)
MAX=temp;
else
MAX=height3;
System.out.println("身高最高的是"+MAX+"cm");
}
}
好看请赞,养成习惯:) 本文来自博客园,作者:靠谱杨, 转载请注明原文链接:https://www.cnblogs.com/rainbow-1/p/13344381.html
欢迎来我的51CTO主页踩一踩~ 我的51CTO博客
文章内出现的订阅h统一搜索:靠谱杨阅读人生