Recognize a power of two · Compiler
Recognize a power of two
Decide whether n can be written as 2 raised to a nonnegative integer exponent. The exponent may be zero.
- Input
- One decimal integer n from 0 to 1000000.
- Output
- Print YES if n is a power of two, otherwise print NO.
Compiler Explorer runs your code when you run or check it.
Loading your exercise draft…