//********************************************************************
// Demonstrates a basic for loop
//********************************************************************

import cs1.Keyboard;

public class For1
{
   //-----------------------------------------------------------------
   //  Reads an even number, n, from the user and prints the sum of all
   //  numbers between 0 and n
   //-----------------------------------------------------------------
   public static void main (String[] args)
   {
      int tom;
      System.out.print ("Enter an integer: ");
      tom = Keyboard.readInt();

      int sum = 0;
      for(int count = 1; count <= tom; count++) {
	  sum += count;
      }
      System.out.print ("the sum of the numbers between 0 and ");
      System.out.println (tom + " is " + sum);
   }
}
