Advertisement
sellmmaahh

OR-Postavke2-BrojRazlicitih

Aug 13th, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int Razliciti (int *niz, int vel) {
  4.     int i, br_razlicitih=0, ima_ga=0,j;
  5.     for (i=0; i<vel; i++) {
  6.             for (j=i+1; j<vel; j++) {
  7.                     if (niz[i]==niz[j])
  8.                   {
  9.                      ima_ga=1;
  10.                       break;
  11.                  }}
  12.                  if (ima_ga==0) br_razlicitih++;
  13.                  ima_ga=0;
  14.     }
  15.     return br_razlicitih;
  16. }
  17. int main () {
  18.     int niz[8]={2, 5, 6, 2, 3, 1, 3, 6};
  19.     printf("%d",Razliciti(niz,8));
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement