Arrays-Spiral Print Clock-Wise: Test-cases Failed

My output is correct but some testcases are failed. Can you please tell me the reason and correct code to pass all testcases?

Problem: https://online.codingblocks.com/app/player/276028/content/265889/4814/code-challenge

My Solution: https://ide.codingblocks.com/s/686888

Note: Please answer my previous unresolve doubts.

Regards,
Haard