解题思路:三个数就不排序了,一一考虑所有情况;
注意事项:
参考代码: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 人评分
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:653 |
C语言程序设计教程(第三版)课后习题5.6 (C语言代码)浏览:901 |
Tom数 (C语言代码)浏览:525 |
C二级辅导-计负均正 (C语言代码)浏览:480 |
DNA (C语言代码)浏览:735 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:463 |
简单的a+b (C语言代码)浏览:460 |
上车人数 (C语言代码)浏览:710 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:713 |
老王赛马 (C++代码)浏览:902 |