question:
count set bits(coding blocks)
answer:
question:
count set bits(coding blocks)
answer:
Check now
what is the meaning of if(num&1). why is if(n!=0) wrong…please clarify
You have to count the total number of set bits. if(num&1) is to check if the last bit of the current number is 1 or not. It will be true if last bit is set and then the count will be incremented.
ok i got it…thanks