#include
int main(int argc, const char * argv[]) {
int arr[4][4]={{25,36,78,13},{12,26,88,93},{75,18,22,32},{56,44,36,58}};
int i,j,temp;
printf("主對角線:\n");
for(i=0;i
printf("%d ",arr[i][i]);
putchar("\n");
printf("副對角線:\n");
printf("%d ",arr[i][4-i]);
printf("交換後:\n");
{
temp=arr[0][i];
arr[0][i]=arr[2][i];
arr[2][i]=temp;
}
for(j=0;j
printf("%d ",arr[i][j]);
return 0;
#include
int main(int argc, const char * argv[]) {
int arr[4][4]={{25,36,78,13},{12,26,88,93},{75,18,22,32},{56,44,36,58}};
int i,j,temp;
printf("主對角線:\n");
for(i=0;i
printf("%d ",arr[i][i]);
putchar("\n");
printf("副對角線:\n");
for(i=0;i
printf("%d ",arr[i][4-i]);
putchar("\n");
printf("交換後:\n");
for(i=0;i
{
temp=arr[0][i];
arr[0][i]=arr[2][i];
arr[2][i]=temp;
}
for(i=0;i
{
for(j=0;j
printf("%d ",arr[i][j]);
putchar("\n");
}
return 0;
}