Created
March 25, 2017 08:35
-
-
Save shumon84/339a827715dac7a31bd147d75ee1157c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int count_bits(int n) | |
{ | |
int sum; | |
for(sum=0;n!=0;n&=n-1) | |
sum++; | |
return sum; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment