Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <limits.h>
- int main(void) {
- int i, j, max = INT_MIN, max_no;
- int score[4][2];
- int sum[4];
- char kyouka[2][7] = {"英語", "数学"};
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 2; j++) {
- printf("%d人目の%sの点数は?", i + 1, kyouka[j]);
- scanf("%d", &score[i][j]);
- }
- sum[i] = score[i][0] + score[i][1];
- }
- for (i = 0; i < 4; i++) {
- if (max < sum[i]) {
- max = sum[i];
- max_no = i;
- }
- }
- puts("2教科の合計が高い人は");
- printf("%d人目で、英語%d点、数学%d点、合計点%d点です。\n",
- max_no + 1, score[max_no][0], score[max_no][1], max);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement