티스토리 뷰

#include <stdio.h>
#define SIZE 4

void main()
{
int a[SIZE][SIZE], b[SIZE][SIZE];
int i, j, n = 0;

for(i = 0 ; i < SIZE ; i++)
for(j = 0 ; j < SIZE ; j++)
{
a[i][j] = ++n;
b[i][j] = 0;
}
for(i = 0 ; i < SIZE ; i++)
for(j = 0 ; j < SIZE ; j++)
b[SIZE - 1 - j][i] = a[i][j];
printf("A = \n");
for(i = 0 ; i < SIZE ; i++)
for(j = 0 ; j < SIZE ; j++)
{
printf("%3d", a[i][j]);

if(j == SIZE - 1)
printf("\n");
}

printf("\nB = \n");

for(i = 0 ; i < SIZE ; i++)
for(j = 0 ; j < SIZE ; j++)
{
printf("%3d", b[i][j]);

if(j == SIZE - 1)
printf("\n");
}
}