import java.util.Scanner;
public class zspx {
public static void main(String [] args){
Scanner input=new Scanner(System.in);
System.out.print("a=");
int a=input.nextInt();
System.out.print("b=");
int b=input.nextInt();
System.out.print("c=");
int c=input.nextInt();
int temp;
if(a>b){
temp=a;
a=b;
b=temp;
}
if(a>c){
temp=a;
a=c;
c=temp;
}
if(b>c){
temp=b;
b=c;
c=temp;
}
System.out.println(a+","+b+","+c);
}
}

解决方案 »

  1.   

    abc,从小到大排啊
      

  2.   

    import java.util.Scanner; //导包
    public class zspx {  //类
    public static void main(String [] args){
    Scanner input=new Scanner(System.in);//从控制台获取数据用的
    System.out.print("a=");//在控制台上打印出 a=
    int a=input.nextInt();//控制台上输入的数据并赋值给a
    System.out.print("b="); //在控制台上打印 b=
    int b=input.nextInt();  //控制台输入数据并赋值给b
    System.out.print("c=");//在控制台上打印出 c=
    int c=input.nextInt();//控制台输入数据并赋值给c
    int temp;//交换变量时用temp做中转站
    if(a>b){//如果a>b,那么交换,交换后a<b,此时a<b
    temp=a;
    a=b;
    b=temp;
    }
    if(a>c){//如果a>c,那么交换,交换后a<c,此时a<b,a<c
    temp=a;
    a=c;
    c=temp;
    }
    if(b>c){//如果b>c,那么交换,交换后b<c,此时a<b<c
    temp=b;
    b=c;
    c=temp;
    }
    System.out.println(a+","+b+","+c);//按照从小到大的顺序输出
    }
    }