C++ program
To find transpose of a matrix
Created by Nitesh Kumar Mehta
Code:
#include<iostream>
using namespace std;
int main()
{
int n,m;
cin>>n>>m;
int a[n][m];
int i,j;
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
cin>>a[i][j];
}
cout<<endl;
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
cout<<a[j][i]<<" ";
cout<<endl;
}
return 0;
}
ConversionConversion EmoticonEmoticon