Computer Science, asked by adityan93, 1 day ago

write a program to print first and power of 2 in Java ​

Answers

Answered by devindersaroha43
1

Answer:

Explanation:

A simple method for this is to simply take the log of the number on base 2 and if you get an integer then number is power of 2.

Another solution is to keep dividing the number by two, i.e, do n = n/2 iteratively. ...

All power of two numbers have only one bit set.

Similar questions