The task is to create a 5×5 matrix filled in a specific pattern where only the lower triangular part is filled. The pattern is described as follows:
The elements are filled diagonally from top to bottom.
For each row, the numbers start from the top left corner and move diagonally downwards until they reach the bottom of the matrix.
After reaching the bottom of the matrix, the numbers move diagonally upwards, filling the remaining lower triangular part.
output
1
2 9
3 8 10
4 7 11 14
5 6 12 13 15
Ram Prasad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1