Advertisement
InnaSibirova

111

Nov 9th, 2019
557
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.21 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int a, i, j  = 0, x;
  5. cin >> a;
  6. i = 7;
  7. for(int c = 0; c <= 30; ++c) {
  8.     x = ((a & i) >> c);
  9.     if (x == 7) {
  10.         j++;
  11.     }
  12.     i <<= 1;
  13.    
  14.  
  15. }
  16. cout << j;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement