比较大小,从大到小排列

import java.util.*;

public class Test2{
//输入三个数字,从小到大排列,并找出最大和最小值。
public static void main(String[] args){
Scanner app=new Scanner(System.in);

System.out.print("请输入第一个数字:");

int a=app.nextInt();
System.out.print("请输入第二个数字:");

int b=app.nextInt();

System.out.print("请输入第三个数字:");

int c=app.nextInt();

int max=a;//假设一个最大值,然后就行比较。

if(max>b&&b>c){
int A=a;
a=c;
c=A;

System.out.print("\n\n从小到大排列:"+a+","+b+","+c);
System.out.println("\nmax:"+c);
System.out.println("mind:"+a);
}else if(max>c&&c>b){
int A=a;
a=b;
b=c;
c=A;

System.out.print("\n\n从小到大排列:"+a+","+b+","+c);
System.out.println("\nmax:"+c);
System.out.println("mind:"+a);
}else if(max<b&&b<c){

System.out.print("\n\n从小到大排列:"+a+","+b+","+c);
System.out.println("\nmax:"+c);
System.out.println("mind:"+a);
}else if(max<c&&max>b){
int A=b;
b=a;
a=A;

System.out.println("\n从小到大排列:"+a+","+b+","+c);
System.out.println("\nmax:"+c);
System.out.println("mind:"+a);
}else if(max<b&&max>c){
int A=c;
c=b;

--来自移动客户端
已邀请:

要回复问题请先登录注册

Template error, template file not found