leetcode-剑指15-OK
language: C
// 除就完了
int hammingWeight(uint32_t n) {
uint32_t a =2;
uint32_t yu;
int ans = 0;
for(int i = 0;i < 32; i++){
yu = n%a;
if(yu ==1)
ans++;
n = n/a;
}
return ans;
}