2

# Power of Two

Difficulty: EASY
Contributed By
Avg. time to solve
15 min
Success Rate
85%

Problem Statement

#### An integer 'N' is a power of two, if it can be expressed as 2 ^ 'K' where 'K' is an integer.

##### Input Format:
``````The first line of input contains an integer ‘T’ representing the number of test cases. Then the test cases follow.

The only line of each test case contains an integer 'N'.
``````
##### Output Format:
``````For each test case, the only line of output prints whether the integer ‘N’ is a power of 2 or not.

The output for each test case is in a separate line.
``````
##### Note:
``````You do not need to print anything; it has already been taken care of. Just implement the given function.
``````
##### Constraints:
``````1 <= T <= 100
-2^31 <= N <= 2^31 - 1

Time Limit: 1sec
``````
##### Sample Input 1:
``````3
16
25
-2
``````
##### Sample Output 1:
``````true
false
false
``````
##### Explanation of Sample Input 1:
``````For the first test case, 16 can be represented as 2^4. So, 16 is the power of two and hence true gets printed.

For the second test case, 25 can not be represented as 2^Kwhere 'K' is integer. So, false gets printed.

For the third test case, -2 can not be represented as 2^K where 'K' is integer. So, false gets printed.
``````
##### Sample Input 2:
``````2
1
10
``````
##### Sample Output 2:
``````true
false
``````
Console