#include <stdio.h>
#include<conio.h>
void main()
{
int i,j,m,n,a[10][10], atran[10][10];
printf("Enter the size of matrix:- ");
scanf("%d%d",&m,&n);
printf("Enter elements:-");
for( i = 0 ; i < m ; i++ )
{
for( j = 0 ; j < n ; j++ )
{
scanf("%d",&a[i][j]);
}
}
for( i = 0 ; i < m ; i++ )
{
for( j= 0 ; j < n ; j++ )
{
atran[j][i] = a[i][j];
}
}
printf("Transpose :-\n");
for( i = 0 ; i< n ; i++ )
{
for( j = 0 ; j< m ; j++ )
{
printf("%d\t",atran[i][j]);
}
printf("\n");
}
}
#include<conio.h>
void main()
{
int i,j,m,n,a[10][10], atran[10][10];
printf("Enter the size of matrix:- ");
scanf("%d%d",&m,&n);
printf("Enter elements:-");
for( i = 0 ; i < m ; i++ )
{
for( j = 0 ; j < n ; j++ )
{
scanf("%d",&a[i][j]);
}
}
for( i = 0 ; i < m ; i++ )
{
for( j= 0 ; j < n ; j++ )
{
atran[j][i] = a[i][j];
}
}
printf("Transpose :-\n");
for( i = 0 ; i< n ; i++ )
{
for( j = 0 ; j< m ; j++ )
{
printf("%d\t",atran[i][j]);
}
printf("\n");
}
}
No comments :
Post a Comment