Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6. struct person
  7. {
  8. char firstname[30];
  9. char lastname[30];
  10. int math;
  11. int inf;
  12. int rus;
  13. float sr;
  14. };
  15.  
  16. int N;
  17. scanf("%d", &N);
  18. struct person info[N];
  19.  
  20. float balls = 0.0;
  21. for (int i = 0; i < N; i++)
  22. {
  23. scanf("%s", info[i].firstname);
  24. scanf("%s", info[i].lastname);
  25. scanf("%d", &info[i].math);
  26. scanf("%d", &info[i].inf);
  27. scanf("%d", &info[i].rus);
  28. info[i].sr = (info[i].math + info[i].inf + info[i].rus) / 3;
  29. balls += info[i].sr;
  30. }
  31. balls /= 3;
  32. for (int i = 0; i < N; i++)
  33. {
  34. if (info[i].sr > balls)
  35. printf("%s %s\n", info[i].firstname, info[i].lastname);
  36. }
  37.  
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement