Thursday, April 3, 2014

PROGRAM TO PRINT THE TRANSPOSE OF A MATRICES

PROGRAM TO PRINT THE TRANSPOSE OF A MATRICES

#include<conio.h>
#include<stdio.h>
void main()
{
int a[10][10],i,j,r,c;
clrscr();
printf("enter the no of rows\n");
scanf("%d",&r);
printf("enter the no of col\n");
scanf("%d",&c);
printf("enter the matrics\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("the elements of matrics\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
printf(" %d ",a[i][j]);
printf("\n\n");
}
printf("the transpose of matrics is\n");
for(i=0;i<c;i++)
{
for(j=0;j<r;j++)
printf(" %d ",a[j][i]);
printf("\n\n");
}
getch();
}

No comments:

Post a Comment