Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.javarush.test.level04.lesson06.task03;
- /* Сортировка трех чисел
- Ввести с клавиатуры три числа, и вывести их в порядке убывания.
- */
- import java.io.*;
- public class Solution
- {
- public static void main(String[] args) throws Exception
- {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- int a = Integer.parseInt(reader.readLine());
- int b = Integer.parseInt(reader.readLine());
- int c = Integer.parseInt(reader.readLine());
- {
- if (a >= b && a >= c)
- System.out.println(a);
- else if (b >= a && b >= c)
- System.out.println(b);
- else
- System.out.println(c);
- }
- {
- if (a >= b && a <= c || a <= b && a >= c)
- System.out.println(a);
- else if (b >= a && b <= c || b <= a && b >= c)
- System.out.println(b);
- else if (c >= a && c <= b || c <= a && c >= b)
- System.out.println(c);
- }
- {
- if (a < b && a < c)
- System.out.println(a);
- else if (b < a && b < c)
- System.out.println(b);
- else if (c < a && c < b)
- System.out.println(c);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement