WAP TO TRANSPOSE THE MATRIX ELEMENTS

 

#include<iostream.h>
#include<conio.h>
Void main()
{
      int a[3][3],i,j;
      clrscr();
      cout<<”Enter the matrix elements:”;
      for(i=0;i<3;i++)
      {
            for(j=0;j<3;j++)
            {
                  cin>>a[i][j];
            }
      }
      cout<<”Matrix elements are:”;
      for(i=0;i<3;i++)
      {
              for(j=0;j<3;j++)
              {
                     cout<<a[i][j];
                     cout<<”\t”;
             }
              cout<<”\n”;
      }
      cout<<”Transpose of matrix is:”;
      for(i=0;i<3;i++)
      {
            for(j=0;j<3;j++)
            {
                 cout<<a[j][i];
                 cout<<”\t”;
            }
             Cout<<”\n”;
      }
       getch();


Comments

Post a Comment

Popular Posts