You are on page 1of 1

//C program to find transpose of given matrix BY CHINMOYEE

#include<stdio.h>
#include <conio.h>
void main()
{
int a[10][10],b[10][10],i,j,m,n;
printf("\n Enter the row and column of matrix : ");
scanf("%d %d",&m,&n);
printf("\n Enter The matrix : ");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
}
}
clrscr();
printf ("\n The Numbers Of Row & Column Of Given Matrix Is : %d : %d",m,n);
printf("\n The matrix is :\n");
for(i=0;i<m;i++)
{
printf("\n");
for(j=0;j<m;j++)
{
printf(" %d\t",a[i][j]);
}
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
b[i][j]=0;
}
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
b[i][j]=a[j][i];
//printf("\n%d",b[i][j]);
}
}
printf("\n\n Traspose of a matrix is : ");
for(i=0;i<m;i++)
{
printf("\n");
for(j=0;j<m;j++)
{
printf(" %d\t",b[i][j]);
}
}
// return 0;
}
EXAMPLE

You might also like