Guest User

Untitled

a guest
Dec 8th, 2018
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4. import java.text.DecimalFormat;
  5.  
  6. /**
  7.  * @author bg_04
  8.  *
  9.  */
  10. public class BiggestOfFive {
  11.  
  12.     /**
  13.      * @param args
  14.      * @throws IOException
  15.      * @throws NumberFormatException
  16.      */
  17.     public static void main(String[] args) throws NumberFormatException, IOException {
  18.         BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  19.  
  20.         double a = Double.parseDouble(reader.readLine());
  21.         double b = Double.parseDouble(reader.readLine());
  22.         double c = Double.parseDouble(reader.readLine());
  23.         double d = Double.parseDouble(reader.readLine());
  24.         double e = Double.parseDouble(reader.readLine());
  25.  
  26.         DecimalFormat df = new DecimalFormat("#.######################");
  27.         if ((a >= b) && (a >= c) && (a >= d) && (a >= e)) {
  28.             System.out.println(df.format(a));
  29.             return;
  30.         }
  31.         if ((b >= a) && (b >= c) && (b >= d) && (b >= c)) {
  32.             System.out.println(df.format(b));
  33.             return;
  34.         }
  35.         if ((c >= a) && (c >= b) && (c >= d) && (c >= e)) {
  36.             System.out.println(df.format(c));
  37.             return;
  38.         }
  39.         if ((d >= a) && (d >= b) && (d >= c) && (d >= e)) {
  40.             System.out.println(df.format(d));
  41.             return;
  42.         }
  43.         if ((e >= a) && (e >= b) && (e >= c) && (e >= d)) {
  44.             System.out.println(df.format(e));
  45.             return;
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment