fork download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. int n = 100, i = 1, res = 0;
  6. while (i) res += bool(n & i), i <<= 1;
  7. std::cout << res;
  8.  
  9. return EXIT_SUCCESS;
  10. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
3