Question: java question. Write a method called printPowersof2 that accepts a maximum number as an argument and prints each power of 2 from 20 degree (1)
Write a method called printPowersof2 that accepts a maximum number as an argument and prints each power of 2 from 20 degree (1) up to that maximum power, inclusive. For example, consider the following calls print Power sof2(3); print Powersof2(10); These calls should produce the following output You may assume that the value passed to printPowersof2 is 0 or greater. (The Math class may help you with this problem. If you use it, you may need to cast its results from double to in so that you don't see a .theta after each number in your output. Also, can you write this program without using the Math class?)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
