Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. public static int Przywodca(int[] tablica)
  2. {
  3. int ile = 0;
  4. int j = 0;
  5. for (int i = 1; i < tablica.Length; i++)
  6. {
  7. if (ile == 0)
  8. {
  9. ile += 1;
  10. j = i;
  11. }
  12. else if (tablica[i] == tablica[j])
  13. {
  14. ile += 1;
  15. }
  16. else
  17. {
  18. ile -= 1;
  19. }
  20. }
  21. return tablica[j];
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement