Display numbers in descending order. Console input 5 4 7. Console output 7 5 4.
package com.codegym.task.task04.task0420;
/*
Sorting three numbers
*/
import java.io.*;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int max = Math.max(Math.max(a, b), c);
int min = Math.min(Math.min(a, b), c);
int mid = 0;
if (a != max && a != min && b != max && b != min) {
mid = c;
} else if(a != max && a != min && c != max && c != min ) {
mid = b;
} else {
mid = a;
}
System.out.println(max + " " + mid + " " + min);
}
}