#include "stdio.h"
#define M 4
#define N 4
void main()
{
int i, k;
int a[M][N] , b[M][N];
for ( i = 0; i < M; i++)
for (k = 0; k < N; k++)
scanf("%d", &a[i][k]);
for ( i = 0; i < M; i++)
for (k = 0; k < N; k++)
b[i][k] = a[k][i];
printf ("原矩阵\n");
for (i = 0; i < M; i++)
{
for ( k = 0; k < N; k++)
printf("%5d", a[i][k]);
printf ("\n");
}
printf ("转换后的矩阵\n");
for (i = 0; i < M; i++)
{
for ( k = 0; k < N; k++)
printf ("%5d", b[i][k]);
printf ("\n");
}
}
输入16个整数,将变为为一个矩阵输出,然后将转换再次输出
最新推荐文章于 2023-05-25 22:15:06 发布