//File: Sum.java import CSLib.*; public class Sum { public static void main (String [] args) { int sum = 0, count = 1; //initialize counter InputBox in = new InputBox("Summing"); in.setPrompt("I will sum the integers from 1 to ?"); int n = in.readInt(); while (count <= n) //test counter { sum = sum + count; count = count + 1; //increment counter } OutputBox out = new OutputBox("1 + 2 + ... + n"); out.setSize(300, 100); out.println ("1 + 2 + ... + " + n + " = " + sum); } }