Facebook
From counting, 5 Years ago, written in C#.
Embed
Download Paste or View Raw
Hits: 237
  1. public static void Zliczanie(int[] tab)
  2.         {
  3.             int n = tab.Length;
  4.             int i, k, c;
  5.             int[] pomocnicza = new int[100];
  6.             for (i = 0; i < 100; i++)
  7.                 pomocnicza[i] = 0;
  8.             for (i = 0; i < n; i++)
  9.                 pomocnicza[tab[i]]++;
  10.             c = 0;
  11.             for (i=0;i<100;i++)
  12.             {
  13.                 if (pomocnicza[i] > 0)
  14.                 {
  15.                     for (k=1;k<pomocnicza[i]+1;k++)
  16.                     {
  17.                         tab[c] = i;
  18.                         c++;
  19.                     }
  20.                 }
  21.             }
  22.         }