My code is not working for N=5
Hi @dare_devil_007
You are not getting correct output because after checking for left diagonal value of x and y changes and then when you try to check for right diagonal then you have forgot to update x and y to i and j respectively. Add x=i;y=j; after line 21.
Here is your corrected code :
If your doubt is clear then mark it as resolved.