#include<iostream> using namespace std; int main() { int n; cin>>n; int a[n][n]; for(int i=0;i<n;i++) for(int j=0;j<n;j++) cin>>a[i][j]; for(int i=0;i<n;i++) for(int j=i+1;j<n;j++) { int temp; temp=a[i][j]; a[i][j]=a[j][i]; a[j][i]=temp; } for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { cout<<a[i][j]; if(j<n-1) cout<<" "; } if(i<n-1) cout<<endl; } } |
Double click to view unformatted code.