Advertisement
sellmmaahh

struktura studenti ispit

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