Friday, February 13, 2015

Three Sort.java in pgm



ThreeSort.java
public class ThreeSort
{
    public static void main(String[] args)
{
        int a = Integer.parseInt(args[0]);
        int b = Integer.parseInt(args[1]);
        int c = Integer.parseInt(args[2]);

        int min    = Math.min(a, Math.min(b, c));
        int max    = Math.max(a, Math.max(b, c));
        int median = a + b + c - min - max;

        System.out.println(min);
        System.out.println(median);
        System.out.println(max);
    }
}

No comments:

Post a Comment