DEV Community

Discussion on: Operations on power of two numbers

Collapse
 
reg__ profile image
Adam Sawicki

This isn't correct. Your code checks if the number is even - 0, 2, 4, 6, 8, 10, 12, 14, ... That's not the same as power of two, which is 1, 2, 4, 8, 16, 32, 64, ...

Collapse
 
lexlohr profile image
Alex Lohr

Ah, that's true, I missed that.