Matrix
Matrix
- Find and display the sum of all prime numbers present in the diagonals of the matrix.
- Write a function `NearestOdd()` that takes a number and returns the nearest odd number (if
even, reduce by 1, if odd, return itself).
- Replace all even numbers in the matrix with the nearest odd number using the
`NearestOdd()` function.
---
- Find and display the sum of all elements present in both the main and secondary diagonals
of the matrix.
- Write a function `NearestMultipleOf5()` that takes a number and returns the nearest
multiple of 5 (rounding up if equally close to two multiples).
- Replace each element in the matrix with its nearest multiple of 5 using the
`NearestMultipleOf5()` function.
- Find the maximum element in each column and replace all elements in that column with the
maximum value.