/* * Use a while loop to compute the sum of the first 10 powers of 2 * * Created: August 2023 * @author gtowell */ public class WhilePower { public static void main(String[] args) { int k = 2; int n = 10; int sum = 0; int i = 0; while (i < n) { sum += Math.pow(k, i); i++; } System.out.println(sum); } }