Program to find the transpose of m*n Matrix | C++ Programming

Tuesday, August 11, 2020

//Program to find the transpose of m*n Matrix

#include<iostream.h>

#include<conio.h>

 void main()

 {clrscr();

 int A[10][10],B[10][10],m,n,i,j;

 cout<<"\n  Enter The No. of rows :";

 cin>>m;

 cout<<"\n Enter The No. of columns :";

 cin>>n;

 for(i=0; i<m;i++)

 {for(j=0; j<n;j++)

 {cout<<"\n Enter A["<<i<<"]["<<j<<"] element :";

 cin>>A[i][j];

  }

 }

 cout<<"\n The Matrix is :";

 for(i=0;i<m;i++)

 {cout<<"\n";

 for(j=0;j<n;j++)

 cout<<A[i][j]<<" ";

}

 for(i=0;i<n;i++)

{for(j=0;j<m;j++)

 B[i][j]=A[j][i];

 }

 cout<<"\n The Transpose Matrix Is :";

 for(i=0;i<n;i++)

 {cout<<"\n";

 for(j=0;j<m;j++)

 cout<<B[i][j] <<"";

 }

 getch();

 }

You Might Also Like

0 Comments

Like us on Facebook

Flickr Images

Flickr Short Films