12 To Transpose A Matrix
12 To Transpose A Matrix
h>
This c program prints transpose of a matrix. It is obtained by printf("Enter the number of rows and columns of
interchanging rows and columns of a matrix. For example if a matrix\n");
matrix is scanf("%d%d", &m, &n);
12 printf("Enter the elements of matrix\n");
34
56 for (c = 0; c < m; c++)
for(d = 0; d < n; d++)
then transpose of above matrix will be
scanf("%d",&matrix[c][d]);
135
246 for (c = 0; c < m; c++)
for( d = 0 ; d < n ; d++ )
When we transpose a matrix then the order of matrix changes,
transpose[d][c] = matrix[c][d];
but for a square matrix order remains same.
printf("Transpose of entered matrix :-\n");
return 0;
}