Code has slight error..could you please mention in program in comments // where there is a problem and please correct the code

question:
playing with bits( coding blocks)

answer:

Hey @aarijrab :grinning:, what you are doing wrong in this question is that suppose you have to find number of set bits between 2 & 4
And binary of
2 is 10
3 is 11
4 is 100
So total number of set bits are 4 i.e., total number of 1 coming between 2 & 4
But what you are calculating is total number of zeroes and one between 2 & 4
Set bits are only 1 , not zero.
I hope i helped you in a right manner :blush:
And i hope You will be able to code it yourself :smiley:

i am not able to rectify the problem…coud you please send me the correct code…

I have wrote this code and have made this code look similar as you have provided me, moreover i have also added comments to understand it better. Hope it will help you in understanding question in a better approach https://ide.codingblocks.com/s/332921