i have tried to write for the given problem but getting some error . please tell me how to correct this code ?
Finding errors in playing with bits problem
hello @Raghavsingla522

here u r updating i inside while loop due to which , correct counting of i is getting affected.
to rectify it , store i in some variable and use that variable to count number of set bits.
1 Like
ok thanks it is running now .