check if a number if a power of 4 or not in o(1) code example
Example: How to check whether the given number is a power of 2 in O(1)
#include
using namespace std;
int main()
{
int n;
cout<<"Enter the number :";
cin>>n;
if(n != 0 && (n & (n-1)) == 0)
{
cout<<"Number is power of 2"<