EX.
NO: 5a               TRANSPOSE OF A MATRIX
DATE:
AIM
      To write a C program to find the transpose of a given matrix.
ALGORITHM:
Step 1: Start
Step 2: Declare matrix a[m][n] of order mxn
Step 3: Read matrix a[m][n] from User
Step 4: Declare matrix t[n][m] of order nxm
Step 5: Find Transpose of Matrix as follows
        Declare variables i, j
        Set i=0, j=0
       Repeat until i < n
         Repeat until j < m
                  t[i][j] = a[j][i]
                  j=j+1
          i=i+1
Step 6: Print matrix t
Step 7: Stop
PROGRAM:
#include <stdio.h>
#include <conio.h>
void main() {
 int a[10][10], transpose[10][10], r, c;
 clrscr();
 printf("Enter rows and columns: ");
 scanf("%d %d", &r, &c);
 printf("\n Enter matrix elements:\n");
 for (int i = 0; i < r; ++i)
 for (int j = 0; j < c; ++j) {
   printf("Enter element a %d %d: ", i + 1, j + 1);
   scanf("%d", &a[i][j]);
 }
 printf("\n Entered matrix: \n");
 for (int i = 0; i < r; ++i)
 {
 for (int j = 0; j < c; ++j) {
   printf("%d ", a[i][j]);
   }
   printf("\n");
 }
 // computing the transpose
 for (int i = 0; i < r; ++i)
 for (int j = 0; j < c; ++j) {
   transpose[j][i] = a[i][j];
 }
  // printing the transpose
  printf("\n Transpose of the matrix:\n");
  for (int i = 0; i < c; ++i) {
  for (int j = 0; j < r; ++j)
    {
      printf("%d ", transpose[i][j]);
    }
      printf("\n");
  }
getch();
}
RESULT:
     Thus, the C program to find the transpose of a given matrix was
executed successfully.