+ 5
write a function which accepts a 2d array and displays the elements which lie on diagonals
if array content is 5 4 3 6 7 8 1 2 9 output should be diagonal 1 : 5 7 9 diagonal 2 : 3 7 1
1 Answer
+ 3
This assignement isn't enough accurate: do you mean squared 2d arrays only (n*n)? ... or are you expecting also result for any 2d arrays (n*m) where diagonal is not as much explicit to be determinated? @@
For first case, that's quite simply done with nested loop ^^