Oa A.

asked • 12/10/16

Write a Java program that prompts the user to enter a number and prints all the positive integer powers of 2 less than or equal that number.

Do not use the method Math.pow() in your solution.
E.g., if the user enters 9, the output should be:
2 to the power 0 = 1
2 to the power 1 = 2
2 to the power 2 = 4
2 to the power 3 = 8

1 Expert Answer

By:

Patrick B. answered • 07/15/19

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.