Linked List append K

my code is :https://ide.codingblocks.com/s/181032

every time it is printing the same linked list .

Small silly mistakes

u are taking cin >> n but while entering data u do n-- so n becomes 0 at the end of the while loop

But then k=k%n; gets u a wrong answer in this case

so take a len = n then do a k = k%len
Check this out

sry my bad :frowning: and thanks.

1 Like

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.