Advertisement
Azazavr

com.javarush.test.level04.lesson06.task03

Oct 17th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.37 KB | None | 0 0
  1. package com.javarush.test.level04.lesson06.task03;
  2.  
  3. /* Сортировка трех чисел
  4. Ввести с клавиатуры три числа, и вывести их в порядке убывания.
  5. */
  6.  
  7. import java.io.*;
  8.  
  9. public class Solution
  10. {
  11.     public static void main(String[] args) throws Exception
  12.     {
  13.         BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  14.  
  15.         int a = Integer.parseInt(reader.readLine());
  16.         int b = Integer.parseInt(reader.readLine());
  17.         int c = Integer.parseInt(reader.readLine());
  18.  
  19.         {
  20.             if (a >= b && a >= c)
  21.                 System.out.println(a);
  22.             else if (b >= a && b >= c)
  23.                 System.out.println(b);
  24.             else
  25.                 System.out.println(c);
  26.         }
  27.         {
  28.             if (a >= b && a <= c || a <= b && a >= c)
  29.                 System.out.println(a);
  30.             else if (b >= a && b <= c || b <= a && b >= c)
  31.                 System.out.println(b);
  32.             else if (c >= a && c <= b || c <= a && c >= b)
  33.                 System.out.println(c);
  34.         }
  35.         {
  36.             if (a < b && a < c)
  37.                 System.out.println(a);
  38.             else if (b < a && b < c)
  39.                 System.out.println(b);
  40.             else if (c < a && c < b)
  41.                 System.out.println(c);
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement