use bitwise operator

given a number, write a program to see whether it is divisible by 15..
don't use / operator...

use bitwise operator

Another solution:
Simply keep on substracting 15 from x until result becomes 0 or negative. If result is zero, x is divisible by 15. if negative then not divisible :)

use bitwise operator

If the '%' operator is allowed....simply check the remainder of number%15. If it is 0, it is divisible, else not....however % uses / internally..... :)

use bitwise operator

n % k is equivalent to n & (k-1) as long as k is a power of 2..

E.g. 32 % 16 == 0

so 32 & 15 is also 0

This is true only when k is a power of 2 as I mentioned.

use bitwise operator

Somehow i dont agree with geekgod! Say 30 is divisible by 15 but 31=(30 + 1) is not divisible by 16. So ur statement isnt true! Am i right!

[quote="geekgod"]If a number n is divisible by 15.. then n+1 is divisible by 16

to check if n+1 is divisible by 16 you can either use
(n+1) % 16 == 0 OR
(n+1) & 15 == 0[/quote][color=red][/color][size=18][/size][size=12][/size]

use bitwise operator

n % k is equivalent to n & (k-1) as long as k is a power of 2..

use bitwise operators..(avoid /,%)

(n+1) & 15 == 0 ---->will this work for any input????
it will not work..

use bitwise operator

If a number n is divisible by 15.. then n+1 is divisible by 16

to check if n+1 is divisible by 16 you can either use
(n+1) % 16 == 0 OR
(n+1) & 15 == 0