Advertisement
Samuella

Biggest of five

May 11th, 2020
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. import java.util.*;
  2. public class Main {
  3.     public static void main(String[] args) {
  4.         Scanner input = new Scanner(System.in);
  5.  
  6.         double[] array = new double[5];
  7.         double maxNum = -201;
  8.         for (int i = 0; i < 5; i++) {
  9.             array[i] = Double.parseDouble(input.nextLine());
  10.         }
  11.         for (int i = 0; i < 5; i++) {
  12.             if (array[i] <= 200 && array[i] >= -200) {
  13.                 for (i = 0; i < 5; i++) {
  14.  
  15.                     if (array[i] > maxNum) {
  16.                         maxNum = array[i];
  17.                     }
  18.                 }
  19.                 System.out.println(maxNum);
  20.             }
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement