Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- int number, count = 0;
- cin >> number;
- for (int i=0; i < 32; i++)
- {
- cout << "Сдвинуто";
- cout << (number >> i);
- cout << "Первый бит";
- cout << (number >> i) & 1;
- count += (number >> i) & 1;
- }
- if(count == 1)
- {
- cout << "YES";
- }
- else
- {
- cout << "NO";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement