Playing With Bits @hb

https://hack.codingblocks.com/contests/c/452/102
https://ide.codingblocks.com/s/33078

please correct the code

https://ide.codingblocks.com/s/33086

I have corrected the code
k=(k>>1) was required.

But in this case ,k is not in terms of its binary representations,its a decimal number so how is it working?