Advertisement
sellmmaahh

struktura s ispita

Feb 6th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. struct Tacka
  5. {
  6.     double x,y;
  7. };
  8. struct Kruznica
  9. {
  10.     struct Tacka c;
  11.     float r;
  12. };
  13.  
  14. void funk(struct Kruznica* niz, int vel, float* a, float* b, float* c)
  15. {
  16.     int i=0, br1=0, br2=0, br3=0;
  17.     float s1, s2, s3;
  18.     for (i=0; i<vel; i++)
  19.     { if (niz[i].r<1)
  20.     {
  21.         s1+=(niz[i].r)*(niz[i].r)*3.14;
  22.         br1++;
  23.     }
  24.     else if (niz[i]>1 && niz[i]<2)
  25.     {
  26.         s2+=(niz[i].r)*(niz[i].r)*3.14;
  27.         br2++;
  28.     }
  29.     else (niz[i].r>2)
  30.     {
  31.         s3+=niz[i].r;
  32.         br3++;
  33.     }
  34.        
  35.     }
  36.     *a=s1/br1;
  37.     *b=s2/br2;
  38.     *c=s3/br3;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement