Mar 092016
 

Given a square matrix of order N*N, write code to print all the elements in the order of their diagonal in alternate forward and backward order.

For example, in the below matrix, the elements should be printed in the marked (in red) order, and the final output should be as shown below:

Diagonals of a matrix

Note that the diagonals are printed in alternate order.

Continue reading »