Please check the code

where i am wrong
do not passes test caseshttps://ide.codingblocks.com/s/248550

@dkroy8790 for k>n you have to do k=k%n as k>=n (not mentioned in the question sorry about that)
i hope its cleared if yes dont forget to mark the doubt resolved and hit like :smiley: