Advertisement
adonitakos

LottoArray

Feb 18th, 2020
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. public class LottoArray {
  2.  
  3.     public static void main(String[] args) {
  4.     // Variables & Arrays:
  5.         int [] array = new int [6];
  6.    
  7.         int luckyLotto = 7;
  8.         int luckySum = 35;
  9.        
  10.     // Loops:  
  11.         System.out.println("6 random integers:");
  12.         for(int random = 0; random < array.length; random++)
  13.         {
  14.             array[random] = (int)(50 * Math.random() + 1);
  15.             System.out.println(array[random]);
  16.            
  17.             for(int l = 0; l < 1; l++)
  18.             {
  19.                 if (array[random] == 7)
  20.                     System.out.println("You picked the lucky lotto number!");
  21.                 else
  22.                     System.out.println("You did not pick the lucky lotto number");
  23.             }
  24.  
  25.         } // <--- end of for-loop
  26.        
  27.         for (int i = 0; i < 1; i++)
  28.         {
  29.             int sum = 0;
  30.             sum = array[i] + sum;
  31.             System.out.println("\n\nThe sum of the integer values: " + sum);
  32.  
  33.         }
  34.        
  35.     } // <--- main method ends here
  36.  
  37. } // <--- class ends here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement