// **************************************************************** // PowersOf2.java // // Print out as many powers of 2 as the user requests // // **************************************************************** import java.util.Scanner; public class PowersOf2 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int nextPowerOf2 = 1; // current power of 2 int exponent = 0; // highest power of 2 to compute System.out.print("Enter the highest power of 2 you want to display?"); exponent = scan.nextInt(); while (exponent >= 0) { // fill in loop body here } } }