Problem:
Sorting Three Numbers

Write a program which reads three integers, and prints them in ascending order.

Input

Three integers separated by a single space are given in a line.

Output

Print the given integers in ascending order in a line. Put a single space between two integers.

Constraints

1 ≤ the three integers ≤ 10000

Sample Input 1

3 8 1

Sample Output 1

1 3 8

Solution in JAVA (judge verdict: Wrong Answer)

import java.util.Scanner;
class Main {
 public static void main(String[] args){
  Scanner in = new Scanner(System.in);
  int a = in.nextInt();
  int b = in.nextInt();
  int c = in.nextInt();
  int tmp = 0;
  int[] ary = {a, b, c};
  while(ary[0] > ary[1] || ary[1] > ary[2]){
   if(ary[0] > ary[1]){
    tmp = ary[0];
    ary[0] = ary[1];
    ary[1] = tmp;
   }
   if(ary[1] > ary[2]){
    tmp = ary[1];
    ary[1] = ary[2];
    ary[2] = tmp;
   }
  }
  for(int i : ary) System.out.println(i);
 }
}