Guest User

Untitled

a guest
Jan 25th, 2021
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SortThree {
  4.     public static void main(String[] args) {
  5.         Scanner input = new Scanner(System.in);
  6.  
  7.         int a = input.nextInt();
  8.         int b = input.nextInt();
  9.         int c = input.nextInt();
  10.  
  11.         if (a >= -1000 && a <= 1000 && b >= -1000 && b <= 1000 && c >= -1000 && c <= 1000) {
  12.  
  13.             if (a >= b && a >= c && b >= c) {
  14.                 System.out.printf(a + " " + b + " " + c);
  15.             } else if (a >= b && a >= c && c >= b) {
  16.                 System.out.printf(a + " " + c + " " + b);
  17.             } else if (b >= a && b >= c && a >= c) {
  18.                 System.out.printf(b + " " + a + " " + c);
  19.             } else if (b >= a && b >= c && c >= a) {
  20.                 System.out.printf(b + " " + c + " " + a);
  21.             } else if (c >= a && c >= b && b >= a) {
  22.                 System.out.printf(c + " " + b + " " + a);
  23.             } else if (c >= a && c >= b && a >= b) {
  24.                 System.out.printf(c + " " + a + " " + b);
  25.             }
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment