#include
int main()
{
int num,NOBITS;
unsigned int firstbitmask=1,lastbitmask,x,y;
NOBITS=8*sizeof(int)-1;
lastbitmask=firstbitmask<firstbitmask)
{
x=num&lastbitmask;
y=num&firstbitmask;
if(((x==0)&&(y==0))||(x && Y))
{
lastbitmask <<=1;
firstbitmask >>=1;
}
else break;
}
if(lastbitmask==firstbitmask)
printf("YES");
else
printf("NO");
return 0;
}
No comments:
Post a Comment