+ 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

8th Sep 2017, 11:50 AM
Kai
Kai - avatar
1 ответ
+ 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 ^^
8th Sep 2017, 12:53 PM
visph
visph - avatar