#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int count_one_bits(unsigned val) {
int count = 0;
int i = 0;
for (; i < 32; ++i) {
if (((val >> i) & 1) == 1) {
++count;
}
}
return count;
}
int main() {
unsigned int n = 0;
scanf("%u", &n);
printf("%d\n", count_one_bits(n));
system("pause");
return 0;
}
127
7
请按任意键继续. . .