解题思路:三个数就不排序了,一一考虑所有情况;
注意事项:
参考代码: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 人评分
C语言程序设计教程(第三版)课后习题6.9 (C语言代码)浏览:543 |
【金明的预算方案】 (C++代码)浏览:940 |
【金明的预算方案】 (C++代码)浏览:843 |
C语言程序设计教程(第三版)课后习题8.5 (C语言代码)浏览:577 |
DNA (C语言代码)浏览:540 |
1908题解浏览:640 |
【亲和数】 (C语言代码)浏览:600 |
罗列完美数 (C语言代码)浏览:491 |
交换Easy (C语言代码)浏览:761 |
单词个数统计 (C语言代码)浏览:1012 |