Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***
- Bismillahir Rahmanir Rahim
- _______
- | __ \ _____
- | |__| )_______ | / ____ ______
- | ____/ \__ \ | |__ / \ | \
- | ( / __ \ | __ \ / __ \ | /\ \
- | | (____ / | / \ / |__/ \ )
- |__| \/ |____/ \____/ \/
- ***/
- #include<bits/stdc++.h>
- using namespace std;
- bool isPowerOfTwo(int n)
- {
- return (n && !(n & (n-1)));
- }
- int main()
- {
- int n;
- while(cin>>n)
- {
- if(isPowerOfTwo(n))
- {
- cout<<"YES\n\n";
- }
- else
- {
- cout<<"NO\n\n";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment