public class CumulativeAlgorithms { public static void main(String[] args) { cumulativeSum(); cumulativeMultiplication(); } // Prints the sum of numbers 1 to 1000 public static void cumulativeSum() { int result = 0; // Must initialize outside the loop for (int i = 1; i <= 1000; i++) { result = result + i; } System.out.println("The result is: " + result); } // Prints out the result of 2 ^ 10 public static void cumulativeMultiplication() { int result = 1; // Must start at 1 for multiplication for (int i = 1; i <= 10; i++) { result = result * 2; } System.out.println("The result is: " + result); } }