Transpose of Matrix

Transpose of Matrix using C++



========================================================================



#include<iostream>
using namespace std;
main()
{
int arr[10][10];
int col,row;
cout<<"Enter Number of Row and Column You Want\n";
cin>>row>>col;
cout<<"\nEnter values in array\n";
for(int i=0;i<row;i++)
{
for(int j=0;j<col;j++)
{
cin>>arr[i][j];
}
cout<<endl;
}
cout<<"Original Matrix\n\n";
for(int i=0;i<row;i++)
{
for(int j=0;j<col;j++)
{
cout<<arr[i][j]<<" ";
}
cout<<endl;
}
cout<<endl<<endl<<endl;
cout<<"Transpose of Original Matrix\n\n";
for(int i=0;i<col;i++)
{
for(int j=0;j<row;j++)
{
cout<<arr[j][i]<<" ";
}
cout<<endl;
}
}

=======================================================================

OutPut : 



SHARE
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment