How to transpose a entered matrice in c program

Transpose of a matrice

#include<stdio.h>
#include<conio.h>
void main()
{
 int a[3][3],i,j;
 clrscr();
 printf("Enter Matrice row wise:-\n");

 for(i=0;i<3;i++)
  {
   for(j=0;j<3;j++)
    {
     scanf("%d",&a[i][j]);
    }
  }
  printf("Transpose Matrice is:-\n");
  for(i=0;i<3;i++)
  {
   for(j=0;j<3;j++)
    {
     printf("%d ",a[j][i]);

    }
    printf("\n");
  }
 getch();
}

OUTPUT:-

transpose of a matrice

Leave a Reply

Your email address will not be published. Required fields are marked *