#include "stdio.h"
void main()
{
int a[5][6]={1,3,4,2,5,2,
2,3,6,3,8,3,
2,9,7,9,4,8,
6,3,8,1,9,3,
9,3,5,2,8,5,};
int s90[6][5],ni90[6][5],x180[5][6];
int i,j;
printf("順時針旋轉90度矩陣為:\n");
for(i=0;i
for(j=0;j
s90[i][j]=a[4-j][i];
printf("%2d%",s90[i][j]);
}
printf("\n");
printf("逆時針旋轉90度矩陣為:\n");
s90[i][j]=a[j][5-i];
printf("旋轉180度矩陣為:\n");
s90[i][j]=a[4-i][5-j];
#include "stdio.h"
void main()
{
int a[5][6]={1,3,4,2,5,2,
2,3,6,3,8,3,
2,9,7,9,4,8,
6,3,8,1,9,3,
9,3,5,2,8,5,};
int s90[6][5],ni90[6][5],x180[5][6];
int i,j;
printf("順時針旋轉90度矩陣為:\n");
for(i=0;i
{
for(j=0;j
{
s90[i][j]=a[4-j][i];
printf("%2d%",s90[i][j]);
}
printf("\n");
}
printf("逆時針旋轉90度矩陣為:\n");
for(i=0;i
{
for(j=0;j
{
s90[i][j]=a[j][5-i];
printf("%2d%",s90[i][j]);
}
printf("\n");
}
printf("旋轉180度矩陣為:\n");
for(i=0;i
{
for(j=0;j
{
s90[i][j]=a[4-i][5-j];
printf("%2d%",s90[i][j]);
}
printf("\n");
}
}