Code:						
#include <iostream>
using namespace std;
int main()
{
	int array[3][3];
	cout<<"Enter the numbers of the matrix : "<<endl;
	for (int i=0;i<3;i++)
	{
		for (int j=0;j<3;j++)
		{
			cin>>array[i][j];
		}
	}
	cout<<"The orginal matrix is given below : "<<endl;
	for (int i=0;i<3;i++)
	{
		for (int j=0;j<3;j++)
		{
			cout<<array[i][j]<<" ";
		}
	    cout<<endl;
	}
	cout<<"The matrix after transpose is : "<<endl;
	for (int j=0;j<3;j++)
	{
		for (int i=0;i<3;i++)
		{
			cout<<array[i][j]<<" ";
		}
	    cout<<endl;
	}
}
Result:

Comments
Post a Comment