Advertisement
lol1234561

Untitled

Apr 27th, 2023
576
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. import java.util.Random;
  2. public class Main {
  3.    public static void main(String[] args) {
  4.          Random rand = new Random();
  5.         int[] a1 = new int[10];
  6.         int[] a2 = new int[10];
  7.  
  8. int min = 1;
  9. int max = 100;
  10.  
  11.  
  12.        System.out.print("Array 1: ");
  13. for(int x = 0; x< a1.length; x++){
  14.     a1[x] = rand.nextInt(max-min + 1) + min;
  15.     a1[9] = -7;
  16.     System.out.print(a1[x] + " ");
  17.  
  18. }
  19.        System.out.println(" ");
  20.        System.out.print("Array 2: ");
  21.  
  22.        for(int y = 0; y< a2.length; y++){
  23.            a2[y] = rand.nextInt(max-min + 1) + min;
  24.            System.out.print(a2[y] + " ");
  25.  
  26.        }
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement