代码
#include<stdio.h>
#define n 4
int main() {
int arr1[n][n] = {0};
int arr2[n][n]={0};
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
scanf_s("%d", &arr1[i][j]);
}
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
arr2[j][n-i-1] = arr1[i][j];
}
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
printf("%3d", arr2[i][j]);
}
printf("\n");
}
}
结果: