1.
int main() { int num = 0; int count = 0; scanf("%d", &num); while (num) { if (num % 2 == 1) { count++; } num /= 2; } printf("%d\n", count); return 0; }
2.
int main() { int num = 0; scanf("%d", &num); int i = 0; int count = 0; for (i = 0; i <=32;i++) { if ((num >> i) & 1 == 1) count++; } printf("%d\n", count); return 0; }
3.
int main() { int n = 0; scanf("%d", &n); int count = 0; while (n) { if (n) { count++; } n = n & (n - 1); } printf("%d\n", count); return 0; }