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