View Code of Problem 45

#include <iostream>
using namespace std;

int main(){
  int n;
  while(scanf("%d",&n)!=EOF){
    int m[n][n];
    for(int j=0;j<n;j++){
      for(int k=0;k<n;k++){
        scanf("%d",&m[j][k]);
      }
    }
    for(int j=0;j<n;j++){
      for(int k=0;k<n;k++){
        if(k==0)
          printf("%d",m[k][j]);
        else
          printf(" %d",m[k][j]);
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}

Double click to view unformatted code.


Back to problem 45