Friday 23 March 2012

how to transpose a metrix


#include<stdio.h>
main()
{
 int a[10][10],i,j,r,c;
 printf("enter the order of matrix");
 scanf("%d%d",&r,&c);
 printf("enter the elements");
 for(i=1;i<=r;i++)
 {
  for(j=1;j<=c;j++)
   scanf("%d",&a[i][j]);
 }
 printf("the transpose is \n");
 for(i=1;i<=c;i++)
 {
  for(j=1;j<=r;j++)
  {
   printf(" %d",a[j][i]);
  }

 printf("\n");
}
}

No comments:

Post a Comment