It seems difficult question for them, who have encountered these type of earlier. This type of question checks your understandings of bitwise and logical operators. See solution below.
if( num && (num & (num – 1)))
{
printf(“Number is not the power of two\n”);
}
else
{
printf(“Number is the power of two\n”);
}
There is may be some good solution, if you have please post here.