Transpose of matrix

                                                 Transpose of matrix

The transpose of a matrix A is a matrix formed formed from A by interchanging the rows  and columns such that row i of a matrix  A becomes column i of the transposed matrix.The transpose of A is denoted by AT.Each element a aq in A becomes element ap in AT.If A is a m by n matrix ,then AT is an n and m matrix .The  following represents a matrix and its transpose.




C program to transpose matix:- 

#include <stdio.h>
#include <conio.h>

void main()
{
 int a[3][3],i,j;
 clrscr();
 printf("\n\t Enter Matrix : ");
 for(i=0;i<3;i++)
 {
  for(j=0;j<3;j++)
  {
   scanf("%d",&a[i][j]);
  }
 }
 printf("\n\t Transpose of Matrix is : \n\n");
 for(i=0;i<3;i++)
 {
  for(j=0;j<3;j++)
  {
   printf("\t%d",a[j][i]);
  }
  printf("\n");
 }
 getch();
}



Output:-
 
Enter Matrix : 2 1 2
	3 2 1
	2 3 3
	
	Transpose of Matrix is :
	
	2	3	2
	1	2	3
	2	1	3

Comments

Popular posts from this blog