View Code of Problem 45

#include<bits/stdc++.h> 
using namespace std;
int main(){
	int n,i,j;
	int a[20][20],b[20][20];
	cin>>n;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++)
		cin>>a[i][j];
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++)
		b[j][i]=a[i][j];
	}
	for(i=0;i<n;i++){
		for(j=0;j<n-1;j++)
		cout<<b[i][j]<<" ";
		cout<<b[i][n-1]<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 45