import java.util.Scanner;
//Enter three integers x , y , z , please put the three number from small to large output
public class fitteen {
public static void main(String[] args) {
// TODO Auto-generated method stub
//首先肯定是键盘录入
Scanner sc=new Scanner(System.in);
//定义键盘输入的三个量,即是x/y/z
int x=sc.nextInt();
int y=sc.nextInt();
int z=sc.nextInt();
//关闭键盘输入
sc.close();
smalltolarge(x,y,z);
}
//定义三个数从小到大排布
static void smalltolarge(int x,int y,int z)
{
//定义一个中间数
int temp=0;
//定义一个StringBuffer
String stb=new String();
//本来想比较从x<y这方面着手的,但是发现这样的话程序完全写不下去,所以我们只考虑x>y的情况
if(x>y)
{
temp=x;
x=y;
y=temp;
}
if(x>z)
{
temp=x;
x=z;
z=temp;
}
if(y>z)
{
temp=y;
y=z;
z=temp;
}
stb=x+"<"+y+"<"+z;
System.out.println(stb);
}
}
15 排序
最新推荐文章于 2021-12-03 21:13:21 发布