Advertisement
Josif_tepe

Untitled

Mar 20th, 2022
652
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4.  
  5. struct ucenik {
  6.     char ime[50], prezime[50];
  7.     int godini;
  8.     int ocenki[10];
  9. };
  10. double prosek(struct ucenik u) {
  11.     double suma = 0.0;
  12.     for(int i = 0; i < 10; i++) {
  13.         suma += u.ocenki[i];
  14.     }
  15.     suma /= 10.0;
  16.     return suma;
  17. }
  18. int main() {
  19.     struct ucenik u;
  20.     scanf("%s%s%d", u.ime, u.prezime, &u.godini);
  21.     for(int i = 0; i < 10; i++) {
  22.         scanf("%d", &u.ocenki[i]);
  23.     }
  24.     printf("%.2lf\n", prosek(u));
  25.    
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement