View Code of Problem 45

#include<stdio.h>
main(){
  int N;
  int i,j,t;
  int a[20][20];
  scanf("%d",&N);
  for(i=0;i<N;i++)
  {for(j=0;j<N;j++){
     scanf("%d",&a[i][j]);}
  }
  for(i=0;i<N;i++)
  {for(j=0;j<N;j++)
   { t=a[i][j];
     a[i][j]=a[j][i];
    a[j][i]=t;
   }
  }
  for(i=0;i<N;i++)
  {for(j=0;j<N;j++){
    printf("%2d",a[j][i]);}
   printf("\n");}
}

Double click to view unformatted code.


Back to problem 45