Advertisement
sellmmaahh

OR-skriptica-zad4-br po velicini

Aug 16th, 2015
205
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 <stdlib.h>
  3.  
  4. int PoVelicini (float *niz, int vel, float n) {
  5.     int i, veci=1, nema_ga=0;
  6.     for (i=0; i<vel; i++)
  7.     {
  8.         if (niz[i]==n)
  9.             nema_ga=1;
  10.     }
  11.     if (nema_ga==0) return -1;
  12.  
  13.     for (i=0; i<vel; i++)
  14.     {
  15.         if (niz[i]>n) veci++;
  16.     }
  17.     return veci;
  18. }
  19.  
  20. int main () {
  21.    float niz[5]={3.2,5.5, -8.1, 2.7, 3.1};
  22.     printf("%d", PoVelicini(niz,5,3.1));
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement