#include<iostream.h>
#include<process.h>
#include<conio.h>
void main()
{
int a[10][10],b[10][10],rowa,cola,i,j;
cout<<"enter the number of rows=";
cin>>rowa;
cout<<"enter the number of coloumn=";
cin>>cola;
cout<<"enter the elements of matrix A\n";
for(i=0;i<rowa;i++)
{
for(j=0;j<cola;j++)
{
cout<<"a["<<i<<"]["<<j<<"]"<<"=";
cin>>a[i][j];
}
}
for(i=0;i<rowa;i++)
{
for(j=0;j<cola;j++)
{
b[i][j]=a[j][i]; //transposing
}
}
for(i=0;i<rowa;i++)
{
cout<<endl;
for(j=0;j<cola;j++)
{
cout<<b[i][j]<<" ";
}
}
}
for transposing a matrix we simply interchange the value of the row and coloumn of the matrix and store the elements in serial order into another matrix.