Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.21 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int x;
  7.     cin >> x;
  8.     int res = 0;
  9.     for (int i = 0; i < 32; ++i)
  10.         if ((1 << i) & x)
  11.             res++;
  12.     cout << res;
  13.     return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement