#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,m,row,col,a[10][10];
clrscr();
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]);
}
}
printf("\nGiven Matrix:\n");
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
printf("%d\t",a[i][j]);
}
printf("\n\n");
}
printf("\nTranspose Matrix:\n");
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
printf("%d\t",a[j][i]);
}
printf("\n\n");
}
getch();
}
OUTPUT:
Enter the Rows&col:
2 2
Enter the values of matrix:
2
4
6
8
Given matrix
2 4
6 8
Transpose Matrix:
2 6
4 8
No comments:
Post a Comment
Thank you for using this blog.