What is the error?

logic is correct but there is one mistake

at line no 67 board should be of the size n+1

and loop at line no 68 should run till i<=n

Modified Code