// CSE 142, Spring 2010, Marty Stepp // This program demonstrates a technique called a "cumulative sum" // to compute the sum of the numbers from 1-100. public class Sum { public static void main(String[] args) { // cumulative algorithm (cumulative sum) int sum = 0; for (int i = 1; i <= 10; i++) { sum = sum + i; } System.out.println(sum); } }