answersLogoWhite
Math and Arithmetic
C Programming
Algebra
How To

How to find transpose of a matrix in C programming?


Top Answer
User Avatar
Wiki User
Answered 2010-04-04 05:01:04

its simple

just do this swappping

for(i=0;i<m;i++) /*A*/

for(j=0;j<i;j++) /*B*/

{

x=a[i][j];

a[i][j]=a[j][i];

a[j][i]=x;

}

I think A and B need a change :

/*Permutation : */

for ( i = 0 ; i <= lig ; i++ ) /*A*/

for ( j = 0 ; j <= i ; j++ ) /*B*/

{

int permut = MatA[i][j] ;

MatA[i][j] = MatA[j][i] ;

MatA[j][i] = permut ;

}

/*End of permutation */

printf("\nDISPLAY MATRIX : \n") ;

for ( i = 0 ; i < col ; i++ )

{

for ( j = 0 ; j < lig ; j++ )

{

printf("%d", MatA[i][j]) ;

}

printf("\n") ;

}

001
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0
User Avatar

Your Answer

Loading...

Still Have Questions?

Related Questions

What is matrix programming in C programming?

C Examples on Matrix OperationsA matrix is a rectangular array of numbers or symbols arranged in rows and columns. The following section contains a list of C programs which perform the operations of Addition, Subtraction and Multiplication on the 2 matrices. The section also deals with evaluating the transpose of a given matrix. The transpose of a matrix is the interchange of rows and columns.The section also has programs on finding the trace of 2 matrices, calculating the sum and difference of two matrices. It also has a C program which is used to perform multiplication of a matrix using recursion.C Program to Calculate the Addition or Subtraction & Trace of 2 MatricesC Program to Find the Transpose of a given MatrixC Program to Compute the Product of Two MatricesC Program to Calculate the Sum & Difference of the MatricesC Program to Perform Matrix Multiplication using Recursion


Write a c programme to read a matrix and print its transpose?

//matrix and its transpose #include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { clrscr(); int m, n, c, d, matrix[10][10],transpose[10][10]; printf("Enter the number of rows and columns of matrix "); scanf("%d %d",&amp;m, &amp;n); //storing the elements of matrix printf("Enter the elements of matrix \n"); for( c = 0 ; c &lt; n ; c++ ) { for( d = 0 ; d &lt; m ; d++ ) { scanf("%d",&amp;matrix[c][d]); } } printf("The matrix you have entered is:\n"); for( c = 0 ; c &lt; n ; c++ ) { for( d = 0 ; d &lt; m ; d++ ) { //m is number of rows printf("%d\t",matrix[c][d]); } printf("\n"); } //making transpose for( c = 0 ; c &lt; n ; c++ ) { for( d = 0 ; d &lt; m ; d++ ) { transpose[d][c] = matrix[c][d]; } } printf("Transpose of entered matrix :-\n"); for( c = 0 ; c &lt; m ; c++ ) { for( d = 0 ; d &lt; n ; d++ ) { /* after transpose number of rows is equal to no. of columns of original matrix */ printf("%d\t",transpose[c][d]); } printf("\n"); } getch(); } Output: Enter the number of rows and columns of matrix 3 2 Enter the elements of matrix 1 2 3 4 5 6 The matrix you have entered is 1 2 3 4 5 6 Transpose of entered matrix: 1 4 2 5 3 6


Write a C program to check whether the given matrix is symmetric or not?

First we find transpose of a matrix and then compare it with the original matrix. For a symmetric matrix A^T = A.Step 1 - Accepts a square matrix as inputStep 2 - Create a transpose of a matrix and store it in an arrayStep 3 - Check if input matrix is equal to its transpose or not If it is equal, then the input square matrix is symmetric.Please find the program attached to find the matrices symmetricity.To find whether a matrix symmetric or not we can use the following code:for(i=0;ifor(j=0;jif(a[i][j]!=a[j][i]){ch='n';}


Program to print the transpose of a matrix using functions?

trace of a matrix using functions in c language


C program to find transpose of matrix?

it's just easy to display transpose of matrix. First store the elements of matrix in a[i][j], then display the value of a[j][i] instead of a[i][j]. For more information just visit the below site.link -s4sourcecode.online/2020/03/c-program-to-display-transpose-of-matrix.html?m=1


What is the algorithm to transpose a matrix?

Algorithm: transpose Input: a matrix M[x][y] Output: the transpose of M (a matrix of order y * x) allocate N[y][x] for r = 0 to x-1 // iterate over rows for c = 0 to y-1 // iterate over columns N[c][r] = M[r][c] next c next r return N


What is a sparse matrix in c programming?

Any matrix with more zeros than non-zero elements is known as a sparse matrix.


Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix?

Sp[[Q/Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix|Answer]]ell chec[[Q/Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix&amp;action=edit&amp;section=new|Answer it!]]k your answe[[Q/Discuss:Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix|Disc]][[help/answering questions|guidelin]]Spell check your answeresussionr[[help/signing in|full benefits]] Save C[[Q/Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix|Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 ]][[Q/Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix&amp;action=edit&amp;section=new|Answering 'Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix?']]matrix?ancel[[Q/How many animals are in West Texas|How many animals are in West Texas?]][[Q/How do you increase the number of four wheelers vehicles for servicing in a Service workshop|How do you increase the number of four wheelers vehicles for servicing in a]][[Q/How do you increase the number of four wheelers vehicles for servicing in a Service workshop|How do you increase the number of four wheelers vehicles for servicing in a Service workshop?]] Service workshop?[[Q/How do you increase the number of four wheelers vehicles for servicing in a Service workshop|How do you increase the number of four wheelers vehicles for servicing in a Service workshop?]]More Q&amp;A


A c program to find maximum number in a 3 by 3 matrix?

int matrix[][]; // the matrix to find the max in int max = matrix[0][0]; int r,c; for(r = 0; r &lt; 3; ++r) { for(c = 0; c &lt; 3; ++c) { if(matrix[r][c] &gt; max) { max = matrix[r][c]; } } } // max is now the maximum number in matrix


Where can one find C programming tutorials?

You can find C programming tutorials online at the C programming website. They provide both free and paid tutorials for many aspects of the C and C++ code.


How to write a c programme to calculate determinants of a nxn matrix without using pointers?

You can find the answer of this questions from this link. Also, you can find the related answers to c programming. http://study-for-exam.blogspot.com/2013/04/write-c-progrm-to-find-determinant-of.html#.UXiMc4Jbwxg"


How do I Transpose the key of c major to the key of c?

If you want to transpose the key of C major into the key of C major, then you don't need to do anything!


How do you find matrix in c?

using multidimensional array


Write a program in c to find transpose of a matrix using functions?

#include &lt;stdio.h&gt; #include &lt;conio.h&gt; void transpose(int a[10][10],int ,int); /*Function prototype*/ void main() { int i,j,m,n; int a[10][10], b[10][10]; clrscr(); printf("Enter the order of matrix a\n"); scanf("%d %d", &amp;m, &amp;n); printf("Enter the elements of matrix\n"); for(i=0;i&lt;m;i++) { for(j=0;j&lt;n;j++) { scanf("%d",&amp;a[i][j]); } } printf("Matrix a is\n"); for(i=0;i&lt;m;i++) { for(j=0;j&lt;n;j++) { printf("%3d",a[i][j]); } printf("\n"); } transpose(a,i,j)/*Function call*/ getch(); /* Finding Transpose of matrix*/ void transpose(int a[10][10],int m,int n)/*Function definition*/ for(i=0;i&lt;m;i++) { for(j=0;j&lt;n;j++) { b[i][j] = a[j][i]; } } printf("Its Transpose is\n"); for(i=0;i&lt;m;i++) { for(j=0;j&lt;n;j++) { printf("%3d",b[i][j]); } printf("\n"); } } /*End of main()*/


Write an Algorithm of transpose of sparse matrix?

Algorithm for the Transpose of a Sparse-Matrix:This is the algorithm that converts a compressed-column sparse matrix into a compressed-row sparse matrix. It computes number of rows in A, compares the cummulative sum to generate row pointers and then iterates over each nonzero entry in A, storing the entry in its corresponding row vector. If the matrix resulted in this procedure is a sparce matrix C and can be interpreted as a matrix in compressed-row form then, C is equal to A. If C is a compressed-column matrix, then C contains Transpose of A. The code iscs *cs_transpose(const cs *A, int values){int p,q,j,*cp,*ci,n,m,*Ap,*Ai,*W;cs *C;double *Cx,*Ax;if(!CS_CSC(A))return(NULL);m=A->m;n=A->n;Ap=A->p;Ai=A->i;Ax=A->x;C=cs_spalloc(n,m,Ap[n],values && Ax,0);W=cs_calloc(m,sizeof(int));if(!C!W)return(cs_done(C,W,NULL,0));Cp=C->p;Ci=C->i;Cx=C->x;for(p=0;pW[Ai[p]]++;cs_cumsum(Cp,W,m);for(j=0;j{for(p=Ap[j];p{Ci[q=W[Ai[p]]++]=j;if(Cx)Cx[q]=Ax=[p];}}return(cs_done(C,W,NULL,1));}


Where can you find Doctor Who sheet music for Clarinet?

The best way would be to transpose the piano music for clarinet. Clarinets transpose up a tone (just go up a letter, like A to B, B to C, C to D and if it works out to be a C of an F, make it a sharp!)


How do you Write A program in c language for checking a diagonal matrix?

Write a program in c++ that take input in a integer matrix of size 4*4 and find out if the entered matrix is diagonal or not.


What is the product of matrix A and C?

It's matrix C.


Find the dimensions of the rectangle of largest area that can be inscribed in a circle of radius a in C programming?

Find the dimensions of the rectangle of largest area that can be inscribed in a circle of radius a in C programming


What has the author Samuel C Hanna written?

Samuel C. Hanna has written: 'Linear programming and matrix algebra' -- subject(s): Linear programming, Matrices 'Sets and logic [by] Samuel C. Hanna [and] John C. Saber' -- subject(s): Set theory, Symbolic and mathematical Logic


How do you use transpose in a sentence?

The word "transpose" is term used in music. An example of a sentence using the word would be: We will have to transpose this piece down a major fourth to the key of C.


What is the need to use pointers in C programming?

find the address


Write a C program to find sum of 3 matrices?

matrix


What is Polymorphism in c?

c programming is structured programming


Write a C program using dynamic memory allocation to find the sum of elements of a matrix?

Did you know that memory allocation is not needed to display the matrix? However, the C program is to find the sum of all the elements.