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 a,b,c;
        Scanner scan = new Scanner(System.in);
        a = scan.nextInt();
        b = scan.nextInt();
        c = scan.nextInt();
        int min=0;
        int max=0;
        int mid=0;
        if(a <= b){
            if(a<=c){
                min=a;
                if(c<=b){
                    max=b; 
                    mid=c;
                }else{
                    max=c; 
                    mid=b;
                }
            }else{
                min=c;
                mid=a;
                max=b;
            }
        }else if(a>b){
            if(b<=c){
                min=b;
                if(c<=a){
                    max=a; 
                    mid=c;
                }else{
                    max=c; 
                    mid=a;
                }
            }else{
                min=c;
                mid=b;
                max=a;
            }
        }
        System.out.println(min +" "+ mid +" "+ max);
        scan.close();
        return;
    }
}