/* Transpose of matrix Write
a programe to read a matrix and display its transpose. */
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int
a[10][10],b[10][10],size;
cout<<"\n Enter the size of matrix
: ";
cin>>size;
cout<<"\n
Enter the Elements of Matrix Row wise. \n";
for(int i=0;i<size;i++)
for(int j=0;j<size;j++)
cin>>a[i][j];
cout<<"\n The Entered Matrix is
:\n";
for(i=0;i<size;i++)
{
cout<<"\n";
for(j=0;j<size;j++)
{
cout<<a[i][j]<<"
";
b[i][j]=a[j][i];
}
}
cout<<"\n The Transpose of Matrix
is : \n";
for(i=0;i<size;i++)
{
cout<<"\n";
for(j=0;j<size;j++)
{
cout<<b[i][j]<<"
";
}
}
getch();
}
No comments:
Post a Comment