Skip to content

Instantly share code, notes, and snippets.

@kubawich
Created May 21, 2017 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kubawich/b28039caffa1060b30433d8b4d9fa4f2 to your computer and use it in GitHub Desktop.
Save kubawich/b28039caffa1060b30433d8b4d9fa4f2 to your computer and use it in GitHub Desktop.
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