power of two using bit manipulation
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
if((n&(n-1))==0)cout<<"power of two\n";
else cout<<"Not power of two\n";
return 0;
}
power of two using bit manipulation
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
if((n&(n-1))==0)cout<<"power of two\n";
else cout<<"Not power of two\n";
return 0;
}
0 Comments