Advertisement
YORDAN2347

HighestNumArray

Jan 27th, 2021
827
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Slide24
  4. {
  5.     public static void main (String [] args)
  6.     {
  7.         Scanner in = new Scanner(System.in);
  8.  
  9.         double[] decMax = {-2.8, -8.8, 2.3, 7.9, 4.1, -1.4, 11.3, 10.4,
  10.             8.9, 8.1, 5.8, 5.9, 7.8, 4.9, 5.7, -0.9, -0.4, 7.3, 8.3, 6.5, 9.2,
  11.             3.5, 3, 1.1, 6.5, 5.1, -1.2, -5.1, 2, 5.2, 2.1};
  12.  
  13.         //finds the highest value
  14.         double max = decMax[0];
  15.  
  16.         for (int counter = 1; counter < decMax.length; counter++)
  17.         {
  18.          if (decMax[counter] > max)
  19.          {
  20.           max = decMax[counter];
  21.           System.out.println("The highest maximum for the December is: " + max);
  22.          }
  23.  
  24.         }        
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement