#include <stdio.h>
int main(void) {
int num, x, y, count = 0;
printf("enter the number:");
scanf("%d", &num);
x = num << 1;
y = x ^ num;
y = y + 1;
y = isPowerOfTwo(y);
if(y)
printf("true");
else
printf("false");
}
int isPowerOfTwo (unsigned int x)
{
return ((x > 0) && ((x & (~x + 1)) == x));
}
int main(void) {
int num, x, y, count = 0;
printf("enter the number:");
scanf("%d", &num);
x = num << 1;
y = x ^ num;
y = y + 1;
y = isPowerOfTwo(y);
if(y)
printf("true");
else
printf("false");
}
int isPowerOfTwo (unsigned int x)
{
return ((x > 0) && ((x & (~x + 1)) == x));
}