Hackerearth: A tryst with Chess

I was trying to solve Hackerearth problem “A tryst with Chess” from recursion and backtracking.
In this, we are given a 10x10 chessboard with a knight on coordinate ( I,J ). We have to find the number of blocks on the chessboard that the knight can be at in exactly “N” moves.
Here is my solution to it:https://ideone.com/daI4VO
It only works for 2 of the given test cases there. I am not able to figure out the mistake. Can somebody please help me?