Advertisement
Sta99ot

Untitled

Apr 13th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     int number, count = 0;
  7.     cin >> number;
  8.  
  9.     for (int i=0; i < 32; i++)
  10.     {
  11.         cout << "Сдвинуто";
  12.         cout << (number >> i);
  13.         cout << "Первый бит";
  14.         cout << (number >> i) & 1;
  15.  
  16.         count += (number >> i) & 1;
  17.     }
  18.  
  19.     if(count == 1)
  20.     {
  21.         cout << "YES";
  22.     }
  23.     else
  24.     {
  25.         cout << "NO";
  26.     }
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement