Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //b
- //start sortowania
- int n1 = 20, tmp = 0;
- do
- {
- for (int i = 0; i < n1 - 1; i++)
- {
- if (tab[i] > tab[i + 1])
- {
- tmp = tab[i];
- tab[i] = tab[i + 1];
- tab[i + 1] = tmp;
- }
- }
- n1--;
- }while (n1 > 1);
- //koniec sortowania
- int z;
- for ( z = 0; z < 20; z++)
- {
- Console.Write(tab[z]+", ");
- }
- tab[20] = 1;
- int l_w = 0, ilosc = 0;
- for (int c = 0; c < 20; c++)
- {
- if (tab[c] == tab[c + 1])
- {
- l_w++;
- }
- else
- {
- l_w--;
- if (l_w % 2 == 0)
- {
- l_w = 0;
- ilosc++;
- }
- else
- {
- l_w = 0;
- }
- }
- }
- Console.WriteLine("Ilosc liczb (b): " + ilosc);
- }
- break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement