In this section, we are writing a program for printing the diagonal elements of a given matrix with order mXn.
For example, if the order of matrix is 2X2.
Then, to do the transpose, we require one input matrix and another matrix for storing the result.
result is : 1 4
To write this program, do the following things.
Step 1: read the order of the first matrix
Step 2: read the first matrix
Step 3: write the condition for checking the diagonality and print the result.
Enter the number of rows and columns of matrix
Enter the elements of first matrix
1 2 3
4 5 6
7 8 9
1 5 9