In that if condition setbits&1 we are checking if no o of setbits is even or odd but for 2 setbit is 1 also for 1 setbit is 1 so in both the case 1&1 will give 1 even for 2.So we should check the ith number na? if(i&1) this?
FIND numbers bt 1 to n divisible by prime nos till 20 problem
no
if u have seen the example of 2,3,5
in that u add all those vales which has odd no of set bits and then subtract those with even no of set bits
so
here also irrespective of no u should see the number set bits
but why not ith number because i=1 odd so +,i=2 even so - this can be aslo done na?
i am not understanding what u are wanting to do !!
best to try what u think
if u get the answer very well
else think where u might be wrong
ha sir yeh to meh samjh gayi
but then 1 & 2 walla ka kya bol rahe ho?
I was elaborating this condtn only (i&1}) it will also check even or odd na ? so can we uise this?
yessss
i&1 is used to check if even or odd
i&1 if == 1 then its odd
else even
so it can be instead of that setbits condtn?
nhi sirrr
basically yrr
us no meh kitne set bit h
uska odd aur even count bta rahe h
na ki vo no ( i) odd h ki even
but 1 and 4 and other no same setbit hai so ?
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.

