package lianxi; import java.util.*; public class Sangeshupaixu { public static void main(String[] args) { System.out.println("请输入x的值:"); Scanner shu1=new Scanner(System.in); int x=shu1.nextInt(); System.out.println("请输入y的值:"); Scanner shu2=new Scanner(System.in); int y=shu2.nextInt(); System.out.println("请输入z的值:"); Scanner shu3=new Scanner(System.in); int z=shu3.nextInt(); int m=0; System.out.print("由小到大排序后的结果:"); if (x<y&&x<z) { System.out.print(x+" "); if(y<z) { System.out.print(y+" "+z); } else { System.out.print(z+" "+y); } } if (y<x&&y<z) { System.out.print(y+" "); if(x<z) { System.out.print(x+" "+z); } else { System.out.print(z+" "+x); } } if (z<y&&z<x) { System.out.print(z+" "); if(y<x) { System.out.print(y+" "+x); } else { System.out.print(x+" "+y); } } } }