输入三个整数x,y,z,请把这三个数由小到大输出(知识点:条件语句)
package sjfour; import java.util.Scanner; public class five { public static void main(String[] args){ Scanner sc=new Scanner(System.in); System.out.println("请输入三个整数:"); int x=sc.nextInt(); int y=sc.nextInt(); int z=sc.nextInt(); int d; if(x>y){ d=y; y=x; x=z; } if(x>z){ d=z; z=x; x=d; } if(y>z){ d=z; z=y; y=d; } System.out.println(x+" "+y+" "+z); } }