View Code of Problem 45

  #include<iostream>
    using namespace std;
    int main()
    {
     
  
	int i,j,n;
	cin>>n;
	int a[20][20],b[20][20];
	for(i=0;i<n;i++)
		{
			for( j=0;j<n;j++)
			{
				cin>>a[i][j];
			}
	}
	for(int k=0;k<n;k++)
	{
		for(int s=0;s<n;s++)
		{
			b[k][s]=a[s][k];
	}
	}
	for(int s=0;s<i;s++)
	{
		for(int t=0;t<j;t++)
		{
			if (t != n - 1)
			{
			cout<<b[s][t]<<" ";
			}
			else
			{
				cout<<b[s][t];
			}
		}
		cout<<endl; 
	}
    	return 0;
    }

Double click to view unformatted code.


Back to problem 45