Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- struct Tacka
- {
- double x,y;
- };
- struct Kruznica
- {
- struct Tacka c;
- float r;
- };
- void funk(struct Kruznica* niz, int vel, float* a, float* b, float* c)
- {
- int i=0, br1=0, br2=0, br3=0;
- float s1, s2, s3;
- for (i=0; i<vel; i++)
- { if (niz[i].r<1)
- {
- s1+=(niz[i].r)*(niz[i].r)*3.14;
- br1++;
- }
- else if (niz[i]>1 && niz[i]<2)
- {
- s2+=(niz[i].r)*(niz[i].r)*3.14;
- br2++;
- }
- else (niz[i].r>2)
- {
- s3+=niz[i].r;
- br3++;
- }
- }
- *a=s1/br1;
- *b=s2/br2;
- *c=s3/br3;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement