Https://ide.codingblocks.com/s/162180

please tell me what i am doing wrong

Hey @sarthaksingh
You’re taking input in the wrong order, first k has to be inputted and then n, rest code is fine. Do change this order, it’ll work.