/* Program to Transpose a matrix */
#include<stdio.h>
main()
{
int j,k,a[3][3],b[3][3];
clrscr();
printf("\nEnter the elements for matrix :");
for(j=0;j<3;j++)
{
for(k=0;k<3;k++)
{
printf("\nenter elements for a[%d][%d]:",j,k);
scanf("%d",&a[j][k]);
}
}
for(j=0;j<3;j++)
{
for(k=0;k<3;k++)
b[j][k]=a[k][j];
}
printf("\nthe transpose matrix is ..:\n");
for(j=0;j<3;j++)
{
for(k=0;k<3;k++)
printf("\t%d",b[j][k]);
printf("\n");
}
getch();
}
0 comments:
Post a Comment