Spiral print anticlockwise

Take as input a 2-d array. Print the 2-D array in spiral form anti-clockwise.

Input Format
Two integers M(row) and N(colomn) and further M * N integers(2-d array numbers).

solution link:https://ide.codingblocks.com/s/260457

one test case is not passing

not working for an uneven matrix

@1799sanya
the conditons for last column and last row can have equality also.
(i) if(sc <= ec)
(ii) if(sr <= er)

After this it will get accepted.
Please mark this doubt as resolved if it is solved after this.