Skip to content

Commit

Permalink
Merge pull request AdarshAddee#54 from kedarrr/main
Browse files Browse the repository at this point in the history
Transpose Of Matrix
  • Loading branch information
AdarshAddee committed Oct 1, 2022
2 parents 495c2f4 + b6befbd commit 3937ae6
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions C++/Transpose Of Matrix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter Number of rows and coluns: ";
cin>>n;
int a[n][n];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<"Enter value at "<<i<<","<<j<<": ";
cin>>a[i][j];
}
}

cout<<"Given Matrix: \n";
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<a[i][j];
cout<<" ";
}
cout<<endl;
}

cout<<"Transpose of given Matrix: \n";
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<a[j][i];
cout<<" ";
}
cout<<endl;
}
return 0;
}

0 comments on commit 3937ae6

Please sign in to comment.