/*Transpose Matrix*/
#include<stdio.h>
void main()
{
int i,j,m,row,col,a[10][10],tra[10][10];
printf("Enter the Rows&col:\n");
scanf("%d %d",&row,&col);
printf("\nEnter the values of matrix:\n");
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
scanf("%d",&a[i][j]);
}
}
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
tra[i][j]=a[j][i];
}
}
printf("\nTranspose Matrix:\n");
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
printf("%d\t",tra[i][j]);
}
printf("\n\n");
}
}
#include<stdio.h>
void main()
{
int i,j,m,row,col,a[10][10],tra[10][10];
printf("Enter the Rows&col:\n");
scanf("%d %d",&row,&col);
printf("\nEnter the values of matrix:\n");
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
scanf("%d",&a[i][j]);
}
}
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
tra[i][j]=a[j][i];
}
}
printf("\nTranspose Matrix:\n");
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
printf("%d\t",tra[i][j]);
}
printf("\n\n");
}
}
No comments:
Post a Comment
Thank you for using this blog.