Created
May 21, 2017 12:10
-
-
Save kubawich/b28039caffa1060b30433d8b4d9fa4f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.*; | |
import java.util.*; | |
public class Wichlinski | |
{ | |
public static int[] tab1 = new int[100]; | |
public static int[] tab2 = new int[100]; | |
public static Random gen = new Random(); | |
final static int NR_Z_DZIENNIKA = 27; | |
final static int SUMA_TYCH_LICZB = NR_Z_DZIENNIKA + 5; | |
public static void main(String[] args) | |
{ | |
for(int i = 0; i < tab1.length; i++) | |
{ | |
tab1[i] = gen.nextInt(999); | |
//System.out.println(i + " " + tab1[i]); | |
} | |
int j = 0; | |
while(j < (tab2.length - 1)) | |
{ | |
j++; | |
tab2[j] = tab1[j]; | |
//System.out.println(j + " " + tab2[j]); | |
} | |
for(int k = 0; k < tab2.length ; k++) | |
{ | |
if((tab2[k] % SUMA_TYCH_LICZB) == 0) | |
{ | |
System.out.println("Liczba w tym indeksie jest podzielna bez reszty przez sumę 27 i 5 " + k); | |
} else System.out.println("Na indeksie " + k + " nie ma liczby, która przy dzielieniu przez sumę 27 i 5 daje resztę 0"); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment