View Code of Problem 45

#include<iostream>

using namespace std;

int main(){
	int n;
	cin>>n;
	int matrix[n][n];
	for(int i=0;i<n;++i){
		for(int j=0;j<n;++j){
			cin>>matrix[i][j];
		} 
	}
	for(int i=0;i<n;++i){
		for(int j=0;j<n;++j){
			if(j!=0){
				cout<<" ";
			}
			cout<<matrix[j][i];
		} 
		cout<<endl;
		
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 45