Spiral print anticlockwise

Here’s my code for spiral print anti. I am passing all the cases but it fails for one. I have tried everything but still not getting the answer. Can you tell me where is the problem?

Hey @div_yanshu07
Correction is on line 27 if(ec>=sc)
and line 35 if(er>=sr)