Advertisement
DanikYakush

Task18

Jul 5th, 2022
653
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None
  1. import java.util.Random;
  2. import java.util.Scanner;
  3.  
  4. public class Task18 {
  5.     public static void main(String[] args) {
  6.         int n, k;
  7.         Random rand = new Random();
  8.         Scanner in = new Scanner(System.in);
  9.         n = in.nextInt();
  10.         k = in.nextInt();
  11.         int[] array = new int[n];
  12.         for (int i = 0; i < n; i++) {
  13.             array[i] = rand.nextInt(1, 100);
  14.             if(array[i] % k == 0) System.out.println(array[i]);
  15.         }
  16.     }
  17. }
  18.  
Advertisement
RAW Paste Data Copied
Advertisement