Created
June 5, 2015 15:22
-
-
Save anonymous/ed32a0a5b165af326429 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
struct imenik{ | |
char ime[30]; | |
int brtel; | |
float prosek[10]; | |
}; | |
float average(int ocene[30], int f){ | |
int a; | |
float y=0,x=0; | |
for(a=0;a<f;a++){ | |
x+= ocene[a]; | |
} | |
y = x/f; | |
return y; | |
} | |
main(){ | |
int i,n,f=0, ocene[30]; | |
float y; | |
struct imenik x; | |
printf("Unesite ime:"); | |
scanf("%s",&x.ime); | |
printf("Vase ime je:%s\n",x.ime); | |
printf("Unesite broj telefona:\n"); | |
scanf("%d",&x.brtel); | |
printf("Vas broj telefona je:%d\n",x.brtel); | |
printf("Unesite broj predmeta:"); | |
scanf("%d",&n); | |
for(i=0;i<n;i++){ | |
printf("Ocena:"); | |
scanf("%d",&ocene[i]); | |
f++; | |
} | |
y = average(ocene,f); | |
printf("Vas prosek je %lf",y); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment