C++ PROGRAM TO FIND TRANSPOSE OF A MATRIX
c++ program to find transpose of matrix
#include<iostreame.h>
void main()
{
int m[100][100],r,c,i,j;
clrscr();
cout<<"How many ROW and COLUM";
void main()
{
int m[100][100],r,c,i,j;
clrscr();
cout<<"How many ROW and COLUM";
cin>>r>>c;
cout<<"Enter the Matrix";
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cin>>m[i][j];
}
}
cout<<"The transpose is";
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cout<<m[j][i]);
}
cout<<"\n";
}
getch();
}
cout<<"Enter the Matrix";
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cin>>m[i][j];
}
}
cout<<"The transpose is";
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cout<<m[j][i]);
}
cout<<"\n";
}
getch();
}
Comments
Post a Comment