Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int a;
- int b;
- scanf("%d %d", &a, &b);
- char results[a][1000];
- double totalPoints = 0;
- int maxPoints = 0;
- int minPoints = -1;
- int i;
- for (i = 0; i < a; i++)
- {
- char buff[1000];
- int total = 0;
- int j;
- scanf("%999s", buff);
- for (j = 0; j < b; j++)
- {
- int pts;
- scanf("%d", &pts);
- total += pts;
- }
- if (total > maxPoints)
- {
- maxPoints = total;
- }
- if (minPoints == -1 || total < minPoints)
- {
- minPoints = total;
- }
- totalPoints += total;
- sprintf(results[i], "%s %d", buff, total);
- }
- printf("Average points: %.2f\n", totalPoints / a);
- printf("Max points: %d\n", maxPoints);
- printf("Min points: %d\n\n", minPoints);
- puts("Student results:");
- for (i = 0; i < a; i++)
- {
- puts(results[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement