#include<stdio.h>
#include<conio.h>
int main()
{
int p, q, c, d, a[10][10], b[10][10];
printf("Enter the number of rows and columns of the matrix:");
scanf("%d%d",&p,&q);
printf("Enter the elements of the matrix: \n");
for(c=0;c< p;c++)
{
for( d=0;d< q;d++)
{
scanf("%d",&a[c][d]);
}
}
for(c=0;c<p;c++)
{
for(d=0;d<q;d++)
{
b[d][c] = a[c][d];
}
}
printf("Transpose of the Matrix you entered is:\n");
for(c=0;c<q;c++)
{
for(d=0;d<p;d++)
{
printf("%d\t",b[c][d]);
}
printf("\n");
}
getch();
return 0;
}
Saturday, 28 April 2012
C Program to Calculate the Transpose of a Matrix
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment