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