C program to Transpose Matrix.

#include<stdio.h>
#include<conio.h>
void main()
{
 clrscr();
 int arr[3][3], i, j, arrt[3][3];
 printf("Enter elements in Array : ");
 for(i=0; i<3; i++)
 {
  for(j=0; j<3; j++)
  {
   scanf("%d",&arr[i][j]);
  }
 }

 for(i=0; i<3; i++)
 {
  for(j=0; j<3; j++)
  {
   arrt[i][j]=arr[j][i];
  }
 }
 printf("Transpose of the Matrix\n");
 for(i=0; i<3; i++)
 {
  for(j=0; j<3; j++)
  {
   printf("%d ",arrt[i][j]);
  }
  printf("\n");
 }
 getch();
}
C program to Transpose Matrix. C program to Transpose Matrix. Reviewed by on December 25, 2019 Rating: 5

No comments:

Powered by Blogger.