解题思路:三个数就不排序了,一一考虑所有情况;
注意事项:
参考代码:import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int a,b,c;
a=sc.nextInt();
b=sc.nextInt();
c=sc.nextInt();
if(a>b) {
if(b>c) {
System.out.println(c+" "+b+" "+a);
}
else {
if(a>c) {
System.out.println(b+" "+c+" "+a);
}
else {
System.out.println(b+" "+a+" "+c);
}
}
}
else {//b>a
if(a>c) {
System.out.println(c+" "+a+" "+b);
}
else {
if(b>c) {
System.out.println(a+" "+c+" "+b);
}
else {
System.out.println(a+" "+b+" "+c);
}
}
}
}
}
0.0分
4 人评分