{"id":7132,"date":"2021-08-16T12:23:51","date_gmt":"2021-08-16T06:53:51","guid":{"rendered":"https:\/\/python-programs.com\/?p=7132"},"modified":"2021-11-22T18:39:25","modified_gmt":"2021-11-22T13:09:25","slug":"program-for-transpose-a-matrix-in-python-cpp-programming","status":"publish","type":"post","link":"https:\/\/python-programs.com\/program-for-transpose-a-matrix-in-python-cpp-programming\/","title":{"rendered":"Program for Transpose a Matrix in Python & C++ Programming"},"content":{"rendered":"

In the previous article, we have discussed about\u00a0Program for addition of two matrices in Python & C++ Programming<\/a>. Let us learn Program for Transpose a Matrix in C++ Program and Python.<\/p>\n

What is a matrix:<\/strong><\/p>\n

A matrix is a rectangular sequence of numbers divided into columns and rows. A matrix element or entry is a number that appears in a matrix.<\/p>\n

Example:<\/strong><\/p>\n

\"\"<\/p>\n

Above is the matrix which contains 5 rows and 4 columns and having elements from 1 to 20.<\/p>\n

In this order, the dimensions of a matrix indicate the number of rows and columns.<\/p>\n

Here as there are 5 rows and 4 columns it is called as 5*4 matrix.<\/p>\n

What is Matrix Transpose:<\/strong><\/p>\n

The interchanging of rows and columns is known as a matrix transpose. It’s abbreviated as A’. The element in A’s ith row and jth column will be moved to A’s jth row and ith column.<\/p>\n

\"\"<\/p>\n

Examples for matrix Transpose:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Matrix 1 = 2 3 1 \r\n                 1 2 3<\/pre>\n

Output:<\/strong><\/p>\n

Printing the transpose of matrices : \r\n2 1\r\n3 2\r\n1 3<\/pre>\n

Program for Matrix Transpose<\/h2>\n