Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class ZadankoTablice2 {
- public static void main(String[] args) {
- int []tab = new int[20];
- int []tabIlosc = new int[10];
- Random rand = new Random();
- for(int i=0; i<tab.length; i++){
- tab[i]=rand.nextInt(10)+1;
- tabIlosc[tab[i]-1]+=1;
- System.out.print(tab[i]+" ");
- }
- System.out.print("\nWystąpienia:\n");
- for(int i=0;i<tabIlosc.length;i++){
- System.out.println(i+1+" - "+tabIlosc[i]+" ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement