write a program to print first and power of 2 in Java
Answers
Answered by
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
Computer Science,
22 hours ago
Math,
22 hours ago
English,
1 day ago
Math,
1 day ago
Math,
8 months ago