#include <iostream>
int Count1Bit(int n) {
int count = 0;
while (n > 0) {
count += n & 1;
n >>= 1;
}
return count;
}
int main(void) {
int n = 95; // 0101 1111
int count = Count1Bit(n);
std::cout << "Number of 1 bit = " << count;
return 0;
}
/*
run:
Number of 1 bit = 6
*/