Question: Find the next number for a given number without using any arithmetic operators(use bit operations)

Solution: main()
{
int n;
scanf("%d",&n);
int b=n;
int c=0xFFFE,d=1;
while(b&1==1)
{
b=b>>1;
n=n&c;
c=c<<1;
d=d<<1;
}

n=n| d;
printf("\n%d",n);

return 0;
}