SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.*;
  2.  
  3. public class Tab {
  4.     public static void main(String[] arg){
  5.         int tab[] = new int[20];
  6.         Random los = new Random();
  7.         for (int i = 0; i < tab.length; i++){
  8.             int liczba = los.nextInt(10)+1;
  9.             tab[i] = liczba;
  10.         }
  11.       System.out.print("Wylosowane liczby: ");
  12.         System.out.println(Arrays.toString(tab));
  13.  
  14.         for (int i = 0; i < tab.length ; i++){
  15.             int suma = 0;
  16.             for (int a = 0; a < tab.length ; a++){
  17.             if (tab[i] == tab[a]) suma++;
  18.             }
  19.             System.out.print(" " + tab[i] + "-" + suma);
  20.             }  
  21.     }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top