Advertisement
Azazavr

com.javarush.test.level04.lesson06.task02

Oct 16th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. package com.javarush.test.level04.lesson06.task02;
  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.         int d = Integer.parseInt(reader.readLine());
  19.  
  20.  
  21.         if (a >= b && a >= c && a >= d)
  22.             System.out.println(a);
  23.         else if (b >= a && b >= c && b >= d)
  24.             System.out.println(b);
  25.         else if (c >= a && c >= b && c >= d)
  26.             System.out.println(c);
  27.         else if (d >= a && d >= b && d >= c)
  28.             System.out.println(d);
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement