without using %, / or * , I have to find the no. is divisible by 3 or not?
it might be an interview question.
Thanks.
A number is divisible by three if its binary alternating digit sum is zero:
bool by3(int n) { int s=0; for (int q=1; n; s+=q*(n&1), n>>=1, q*=-1); return !s; }