Trace of Matrix(Problem Code: TRACE)-Beginners(Practice Problems)- C Language

Link to the Problem: TRACE Problem - CodeChef

Can somebody tell me what is wrong with the following solution?
I have generated matrices with random numbers(99 test cases with matrices of all sizes from 2X2 to 100X100),
used them as the input to compare my output with codechef-declared-correct solutions.
I have even checked the corner cases. All my outputs are matching with the codechef-declared-correct solutions. When I submit I keep getting “Wrong Answer”.
Here is my solution:

Link to my solution: CodeChef: Practical coding for everyone -Link to my solution