Transpose of the matrix
This C program is to find transpose of a matrix.
The new matrix obtained by interchanging the rows and columns of the original
matrix is called as the transpose of the matrix. If A = [aij] be an m × n matrix,
then the matrix obtained by interchanging the rows and columns of A would be the
transpose of A. of It is denoted by A′or (AT).
#include<stdio.h>
#include<conio.h>
void main()
{
int a[3][3],i,j;
printf("enter the value of the matrix:-");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("\n****************\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%3d",a[i][j]);
}
printf("\n");
}
printf("\n the transpose of the matrix is :-\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%3d",a[j][i]);
}
printf("\n");
}
getch();
}
#include<conio.h>
void main()
{
int a[3][3],i,j;
printf("enter the value of the matrix:-");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("\n****************\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%3d",a[i][j]);
}
printf("\n");
}
printf("\n the transpose of the matrix is :-\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%3d",a[j][i]);
}
printf("\n");
}
getch();
}

No comments:
Post a Comment