Write a method called powersOfTwo that prints the first 10 powers of 2 (starting with 2). The method takes no parameters and doesn't return anything.
```
public void powersOfTwo()
{
int base = 2;
for (int power = 1; power <= 10; power++)
System.out.println(Math.pow(base,power));
}
```
```
public void powersOfTwo()
{
int num = 2;
for (int power = 1; power <= 10; power++)
{
num *= 2;
System.out.println(num);
}
}
```
Computer Science & Information Technology
You might also like to view...
Setting this order can increase data entry efficiency
a. Entry b. Sort c. Tab
Computer Science & Information Technology
Which of the following is not an advantage of Linux?
a. Standardized operating system. b. Considerable vendor support. c. Many of the tasks performed on the system are unique to that version. d. The Linux approach is becoming the standard.
Computer Science & Information Technology