#include <stdio.h> #define NULL 0 int a,b,c,d; int score[][4] = {{97,90,88,95}, {76,89,75,83}, {60,70,88,82},{83,89,92,85},{75,73,72,78}}; int sum[4] = {a,b,c,d}; int main(void) { int i,j,sum = 0; i = 0, j = 0;
printf(" 중간1 중간2 기말1 기말2 합계 평균\n");
for ( i = 0 ; i < 5 ; i++) {printf("김범용 "); for ( j = 0 ; j < 4 ; j++) { if ( i == 0 ) {a += score[0][j]; printf("%d ", score[i][j]);} else if ( i == 1 ) {b += score[1][j]; printf("%d ", score[i][j]);} else if ( i == 2 ) {c += score[2][j]; printf("%d ", score[i][j]);} else if ( i == 3 ) {d += score[3][j]; printf("%d ", score[i][j]);} }printf("%d ",sum[i]); printf("%d ", (sum / 4)); printf("\n"); } return 0;