A cumulative algorithm is one where you incrementally accumulate a larger value by repeatedly adding, multiplying, etc., and storing the result into a variable over and over.
Key aspect of a cumulative algorithm: A loop, and a variable declared outside the loop whose value is modified inside the loop.
Example: Cumulative algorithm to sum the numbers 1-100:
int sum = 0;
for (int i = 1; i <= 100; i++) {
sum = sum + i;
}
System.out.println(sum); // 5050
Some of the following problems ask you to write cumulative algorithms.