Javascript Program to Interchange Diagonals of Matrix Given a square matrix of order n*n, you have to interchange the elements of both diagonals. Examples : Input : matrix[][] = {1, 2, 3, 4, 5, 6, 7, 8, 9} Output : matrix[][] = {3, 2, 1, 4, 5, 6, 9, 8, 7} Input : matrix[][] = {4, 2, 3, 1, 5, 7, 6, 8, 9, 11, 10, 12, 16, 14, 15, 13} Output : matrix[][] =
2 min read
JavaScript Program to Print Matrix in Diagonal Pattern We have given the n*n size matrix and we need to print the elements of this matrix in the diagonal pattern using JavaScript language. Below are the examples for a better understanding of the problem statement. Examples:Input: mat[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}Output:1 2 4 7 5 3 6 8 9Expla
4 min read