Wednesday, May 11, 2016

Matrix Transpose





#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a[10][10],b[10][10],c[10][10],i,j,m,n;
 printf("Enter Size of A  Matrix :\n");
 scanf("%d%d",&m,&n);
 printf("Enter Elment Of Matrix A : \n");
 for(i=0;i<m;i++)
       for(j=0;j<n;j++)
     scanf("%d",&a[i][j]);
              for(i=0;i<m;i++)
                   for(j=0;j<n;j++)
         b[j][i]= a[i][j];

    printf("\nA Matrix is :\n\n");
 for(i=0;i<m;i++)
 {
              for(j=0;j<n;j++)
    printf("%4d", a[i][j]);
       printf("\n");
 }

 printf("\nTranspose of A matrix is :\n\n");
 for(i=0;i<n;i++)
 {
              for(j=0;j<m;j++)
   printf("%4d", b[i][j]);
       printf("\n");
 }
return 0 ;
}




Share this

0 Comment to "Matrix Transpose "

Post a Comment