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: Accepted)

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int table[] = new int[3];

		Scanner sc = new Scanner(System.in);

		table[0] = sc.nextInt();
		table[1] = sc.nextInt();
		table[2] = sc.nextInt();

		int work;

		for(int base_loc = 0; base_loc <= 1; base_loc++){
			for(int comp_loc = table.length-1;comp_loc >= base_loc+1; comp_loc--){
				if(table[comp_loc] < table[comp_loc-1]){
					work = table[comp_loc-1];
					table[comp_loc-1] = table[comp_loc];
					table[comp_loc] = work;
				}
			}
		}

		for(int i = 0; i < table.length; i++){
			if(i != 0)System.out.printf(" ");
			System.out.printf("%d", table[i]);
		}
		System.out.printf("\n");
	}
}