Print spiral...print

https://ide.codingblocks.com/s/59739
my putput is correct but after submitting all the test cases are going wrong…whats wrong in my code…

Hey Amisha, your code will not work when no. of rows and cols are not equal, check for this case
input:
5 4
11 12 13 14
21 22 23 24
31 32 33 34
41 42 43 44
51 52 53 54

your code’s output:
11, 21, 31, 41, 51, 52, 53, 54, 44, 34, 24, 14, 13, 12, 22, 32, 42, 43, 23, 23, 13, 32, END

but the expected output is:
11, 21, 31, 41, 51, 52, 53, 54, 44, 34, 24, 14, 13, 12, 22, 32, 42, 43, 33, 23, END

Hey Amisha, as you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “Ask Doubt” section, when your doubt is resolved.