0
I have to print square matrix from 1 to nÂČ anticlockwise direction starting from center, idk why it is printing 0.
When printing each one individually, it is printing correctly but when i print it in matrix form using loops it is printing 0 https://code.sololearn.com/chq3OPe135Ce/?ref=app
2 Answers
+ 2
It would be helpful to have two different input output examples which shall be generate with this code.
+ 2
It looks like you just trying to hardcode the solution. Try to print array clock wise first after adding all elements. Then print anticlock wise..
By the way, in 2nd loop, you are starting from arr[x][i] which is arr[1][1] so you skipping arr[1][0] which will be 0 then.
same you doing in 3rd loop. since x = 1. not 0