Advertisement
sellmmaahh

OR-Postavke2-BrPoVelicini

Aug 13th, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3.  
  4. int BrojPoVel (float *niz, int vel, float broj)
  5. {
  6.     int i, u_nizu=0, br_vecih=1;
  7.     for (i=0; i<vel; i++) {
  8.             if (broj==niz[i])
  9.             u_nizu=1;
  10.     }
  11.     if (u_nizu==0) return -1;
  12.  
  13.     for (i=0; i<vel; i++)
  14.     {
  15.       if (niz[i]>broj) br_vecih++;
  16.     }
  17.     return br_vecih;
  18. }
  19.  
  20. int main () {
  21.     float niz[5]={2.3,5,1.1,6.8,9.1};
  22.     printf("%d",BrojPoVel(niz,5,5));
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement