Untitled
unknown
c_cpp
a year ago
298 B
1
Indexable
#include <iostream> using namespace std; int count(unsigned int n) { int count = 0; while (n > 0) { if (n & 1) { count++; } n = n >> 1; } return count; } int main() { unsigned int n; cin >> n; cout << count(n); }
Editor is loading...
Leave a Comment