Transpose a matrix using c++ program

Posted By: Java Examples - 7:29 PM

Share

& Comment

This c program prints transpose of a matrix. It is obtained by interchanging rows and columns of a matrix. For example if a matrix is
1 2
3 4
5 6
then transpose of above matrix will be
1 3 5
2 4 6
When we transpose a matrix then the order of matrix changes, but for a square matrix order remains same.


Algorithm :
Matrix Transpose means changing the order or arrangement of a matrix. If A be the given matrix, then the matrix formed by interchanging the columns and rows of the matrix A without changing the value of elements is called as transpose of a matrix. If Am×n = [aij], then AT(n×m) = [aji] i.e. the (i,j)th element of A is the (j,i)th element of AT. So, in A and AT,
  • ith column of AT = ith row of A
  • jth row of AT = jth column of A
  • In A and AT, the diagonal elements are equal.


C++ program code :



Output of program :

Enter the number of Rows of Matrix 1 : 3

Enter the number of Columns of Matrix 1 : 2
Enter the Element a[0][0] : 1
Enter the Element a[0][1] : 2
Enter the Element a[1][0] : 3
Enter the Element a[1][1] : 4
Enter the Element a[2][0] : 5
Enter the Element a[2][1] : 6

Matrix elements :
1 2
3 4
5 6

Matrix elements :
1 3 5
2 4 6

Date - 1/26/2013-@author Y.ACHCHUTHAN -cpp90.blogspot.com
Press any key to continue . . .

About Java Examples

I’m passionate about Web Development and Programming and I go to extreme efforts to meet my passion. I’m a believer of learning the fundamentals first. I try to understand everything little bit more than the average.

3 comments :

Post a Comment

Copyright © 2016 C++ Examples ACHCHUTHAN.ORG. Designed by Templateism .