I am not getting the output
@Deepanshu_garg
You have implemented incorrect code.
- In the if condition , it should be not of colindex[col]
! colindex[col] - For d1 , the index is (currrow - col + n - 1) , not (col - currrow + n - 1)
- If you wish to make the changes in Board array if you want to print it , then you have to make those changes. You are printing your board array without making any changes in it whatsoever
colindex[col] = d1[currrow - col + n - 1] = d2[col+currrow] = Board[currrow][col] = 1; - Initialise ans variable with 0 instead of 4.