Why my test case 4 is giving error else test case are passing

hello @ayushwahi3005
in this problem n can be 0 as well so handle that case.

image

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.

still not passing https://ide.codingblocks.com/s/299119

take k = k%n this will fixt it


here is another code that you can refer to

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.