Saturday, 28 June 2014

C++ program to find transpose of a matrix

C++ program to find transpose of a matrix.

#include<iostream>
using namespace std;
int main()
{
    int a[10][10],temp,ord;
    cout<<"Enter order of matrix (max 10*10): ";
    cin>>ord;
    cout<<"Enter matrix a1 : "<<endl;
    for(int i=0;i<ord;i++)
        for(int j=0;j<ord;j++)
           cin>>a[i][j];
    cout<<"Transpose of matrix : "<<endl;
    for(int i=0;i<ord;i++)
    {
        for(int j=0;j<ord;j++)
            cout<<a[j][i]<<" ";
        cout<<endl;
    }
    return 0;
}

No comments:

Post a Comment