Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- struct person
- {
- char firstname[30];
- char lastname[30];
- int math;
- int inf;
- int rus;
- float sr;
- };
- int N;
- scanf("%d", &N);
- struct person info[N];
- float balls = 0.0;
- for (int i = 0; i < N; i++)
- {
- scanf("%s", info[i].firstname);
- scanf("%s", info[i].lastname);
- scanf("%d", &info[i].math);
- scanf("%d", &info[i].inf);
- scanf("%d", &info[i].rus);
- info[i].sr = (info[i].math + info[i].inf + info[i].rus) / 3;
- balls += info[i].math + info[i].inf + info[i].rus;
- }
- balls /= N*3;
- printf("%f\n", balls);
- for (int i = 0; i < N; i++)
- {
- if (info[i].sr > balls)
- printf("%s %s\n", info[i].firstname, info[i].lastname);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement