Skip to content

Commit

Permalink
create matrix_transpose.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
pal-gupta97 authored Oct 13, 2020
1 parent 5316147 commit bc38334
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions matrix_transpose.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include<iostream>
using namespace std;
int main()
{
int i,j,n,m;
int arr[100][100],trs[100][100];
cout<<"Enter the number of rows and columns of matrix :";
cin>>n>>m;
cout<<"Enter the matrix elements :";
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
cin>>arr[i][j];
}
}
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
trs[j][i]=arr[i][j];
}
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cout<<trs[i][j]<<" ";
}
cout<<"\n";
}
return 0;
}

0 comments on commit bc38334

Please sign in to comment.