Transpose of a Given Matrix Program in C++

Transpose of a Given Matrix Program in C++

Program to generate transpose of a  given Matrix in C++

Transpose of a Given Matrix Program in C++

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int A[10][10],t[10][10],n,i,j;
cout<<"Enter the size of the the Matrix\n";
cin>>n;
cout<<"Enter the elements of the Matrix\n";
for(i=0;i<n;i++)
for(j=0;j<n;j++)
cin>>A[i][j];
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
   t[i][j]=A[j][i];
}
}
cout<<"The Transpose of the given matrix is:\n";
for(i=0;i<n;i++)
{
for(j=0;j<n;j++) {
      cout<<t[i][j]<<" ";
      }
      cout<<"\n";
}

getch();
}

Comments