Given a square matrix, swap upper diagonal elements of matrix with lower diagonal elements of matrix.
Input: 2 3 5 6 4 5 7 9 8 6 4 9 1 3 5 6 Output: 2 4 8 1 3 5 6 3 5 7 4 5 6 9 9 6 Input: 1 2 3 4 5 6 7 8 9 Output: 1 4 7 2 5 8 3 6 9
Below is the implementation of above idea :
2 4 8 1 3 5 6 3 5 7 4 5 6 9 9 6
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Program to print Lower triangular and Upper triangular matrix of an array
- Sum of upper triangle and lower triangle
- Maximize sum of N X N upper left sub-matrix from given 2N X 2N matrix
- Minimum number of steps to convert a given matrix into Upper Hessenberg matrix
- Maximum sum of elements in a diagonal parallel to the main diagonal of a given Matrix
- Minimum steps required to convert the matrix into lower hessenberg matrix
- Minimize count of adjacent row swaps to convert given Matrix to a Lower Triangular Matrix
- Program to check if matrix is upper triangular
- Filling diagonal to make the sum of every row, column and diagonal equal of 3x3 matrix
- Program to check if matrix is lower triangular
- Program to check diagonal matrix and scalar matrix
- Program to convert given Matrix to a Diagonal Matrix
- Print Upper Hessenberg matrix of order N
- Print Lower Hessenberg matrix of order N
- Construct a square Matrix whose parity of diagonal sum is same as size of matrix
- Program to convert the diagonal elements of the matrix to 0
- Program to find the Product of diagonal elements of a matrix
- Swap the elements between any two given quadrants of a Matrix
- Squares of Matrix Diagonal Elements
- Reverse Diagonal elements of matrix
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.