Incorrect output for even values of n

Why is the output not showing correctly when I am entering even numbers for n?

@saijaltripathy_e79096f8f1ec20e3 This question is only designed for Odd values of n. So it will never give correct output for even n.

Okay, got it! Thank you very much.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.