#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
int main(int argc, char *argv[])
{
int X,i;
while(1)
{
printf("Input X: ");
scanf("%d",&X);
//if((X & (X-1)) == 0)
if((X | (X-1)) != 0)
{
i = log2(X);
printf("%d是2的%d次方!\n",X,i);
}
else
{
printf("%d不是2的幂次方!\n",X);
}
}
return 0;
}