Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int broj_razlicitih(int* niz, int vel)
- {
- int i, j, ponavlja_se, broj_razlicitih = 0;
- for(i = 0; i < vel; i++)
- {
- ponavlja_se = 0;
- for(j = i + 1; j < vel; j++)
- {
- if (niz[i] == niz[j]) ponavlja_se = 1;
- break;
- }
- if (ponavlja_se == 0) broj_razlicitih++;
- }
- return broj_razlicitih;
- }
- int main()
- {
- int niz[] = {2, 5, 6, 2, 3, 1, 3, 6};
- printf("%d", broj_razlicitih(niz, 8));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement