#include <stdio.h>
#define ROWSIZE 5
#define COLSIZE 4

int main(void)
{
	// 3차원 배열 초기화, 첫 번째 크기는 지정하지 않을 수 있음 
	double score[][ROWSIZE][COLSIZE] = 
	{
		{ { 95, 85 },
		  { 85, 83 },
		  { 92, 75 },
		  { 90, 88 } },
		{ { 88, 77 },
		  { 72, 95 },
		  { 88, 92 },
		  { 93, 83 } }
	};

	for (int i = 0; i < 2; i++)
	{
		if (i == 0) 
			printf("[강좌 1]");
		else 
			printf("[강좌 2]");
		printf("%11s%9s%9s%9s%9s\n", "중간", "기말", "합계", "평균", "순위");

		for (int j = 0; j < ROWSIZE; j++)
		{
            score[i][j][2]=score[i][j][0]+score[i][j][1];
            score[i][j][3]=score[i][j][2]/2.0;

            for (int j = 0; j < ROWSIZE; j++){
                int rank = 1;
                for (int k = 0; k < ROWSIZE; k++){
                    if (score[i][j][3] < score[i][j][3]){
                        rank++;
                    }
                }
                score[i][j][4]=rank;
            }
            printf("%10s%2d", "학생", j + 1);
			for (int k = 0; k < COLSIZE-1; k++)
				printf("%6.0f ", score[i][j][k]);
            printf("%7.2f", score[i][j][3]);
            printf("%6.0f", score[i][j][4]);
            printf("\n");
		}
		printf("\n");
	}

	return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: