Write a program to declare a square matrix A[][] of order N (N<20). Allow the user to input positive integers into this matrix. Perform the following tasks on the matrix:

- Output the original matrix.
- Find the SADDLE POINT for the matrix. A saddle point is an element of the matrix such that it is the minimum element for the row to which it belongs and the maximum element for the column to which it belongs. Saddle point for a given matrix is always unique. If the matrix has no saddle point, output the message "NO SADDLE POINT".
- Sort the elements along principal diagonal in ascending order using insertion sort technique. All other elements should remain unchanged.

Test your program for the following data and some random data:

**SAMPLE DATA:**

```
INPUT: N = 4 OUTPUT:
MATRIX A [][] = 2 5 6 9 2 5 6 9
8 4 12 3 8 4 12 3
6 7 3 1 6 7 3 1
12 24 2 11 12 24 2 11
NO SADDLE POINT
MATRIX AFTER SORTING THE PRINCIPAL DIAGONAL
2 5 6 9
8 3 12 3
6 7 4 1
12 24 2 11
```

### Have something to say? Log in to comment on this post.

0 comments