Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Write a program in java, input 3 integers, and then the program will arrange the three integers from largest to smallest
Write a program in java, input 3 integers, and then the program will arrange the three integers from largest to smallest

You can enter three numbers like this

Scanner in=new Scanner(System.in);

int a=in.nextInt();

p>

Scanner in=new Scanner(System.in);

int b=in.nextInt();

Scanner in=new Scanner(System.in);

int c=in.nextInt();

Then compare the three numbers.

int tmp=0;

if(a

tmp=a;

a=b;

p>

b=tmp;

}

if(a

tmp=a;

a =c;

c=tmp;

}

if(b

tmp=b;

b=c;

c=tmp;

}

System.out.println(a+" "+b+" "+c) ;

That’s it. Think about it and use your brain to use it flexibly. If you are just given the code, you will only copy and paste.