Advertisement
Sta99ot

Untitled

Apr 13th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  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.         count += (number >> i) & 1;
  12.     }
  13.  
  14.     if(count == 1)
  15.     {
  16.         cout << "YES";
  17.     }
  18.     else
  19.     {
  20.         cout << "NO";
  21.     }
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement