Thursday, July 30, 2009

How to find the transpose matrix by using C program with detail explaination please!?

For example, find the transpose matrix for this 3x3 matrix, and print it out.





3 5 6


5 -2 8


1 6 -3





Please include the steps on how to set up a matrix in C program, and then transform it to it's transpose matrix. Thank you! =]

How to find the transpose matrix by using C program with detail explaination please!?
using C isn't it?





#include%26lt;stdio.h%26gt;


#include%26lt;conio.h%26gt;


void main()


{


int i,j,m,n,A[10][10],T[10][10]; /*where m is row, n is column of matrix A of row %26amp; column size alloted as 10 each, T assigned the transpose*/


clrscr(); /*To clear up the screen*/


printf("Enter row and column size of a matrix\n");


scanf("%d%d",%26amp;m,%26amp;n); /*To accept the values of m %26amp; n*/


printf("Enter the elements of the matrix\n");


for(i=0;i%26lt;m;i++) /*Loop to accept elements*/


for(j=0;j%26lt;n;j++)


scanf("%d",%26amp;A[i][j]);


printf("\nThe entered matrix is\n"); /*/Show entered matrix*/


for(i=0;i%26lt;m;i++)


{


for(j=0;j%26lt;n;j++)


printf("\t%d",A[i][j]);


printf("\n");


}


for(i=0;i%26lt;n;i++)


for(j=0;j%26lt;m;j++) /*Transposition process*/


T[i][j]=A[j][i];


printf("\nThe transpose of the matrix\n");


/*To display the transposed matrix*/


for(i=0;i%26lt;n;i++)


{


for(j=0;j%26lt;m;j++)


printf("\t%d",T[i][j]);


printf("\n");


}


getch();


}








when u execute it, here's how it looks..........





Enter row and column size of a matrix


3


3


Enter the elements of the matrix


3


5


6


5


-2


8


1


6


-3





The entered matrix is


3 5 6


5 -2 8


1 6 -3





The transpose of the matrix


3 5 1


5 -2 6


6 8 -3








that's it!





ALL THE BEST!!!!!!
Reply:Do your own homework. This is a very easy problem and the answer will come to you if you give it some thought.





Hint: the transpose of the matrix you wrote is


[ 3 5 1]


[5 -2 6]


[ 6 8 -3]
Reply:when i want to search for mathematic or operation research ,liking at this site's :


http://www.codersource.net/


http://archive.devx.com/sourcebank/





or search i IBM site, useful thiing you can see there about operating research.

garden centres

No comments:

Post a Comment