//********************************************************************
// Demonstrates a counting while loop
//********************************************************************

import cs1.Keyboard;

public class While2
{
   //-----------------------------------------------------------------
   //  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 count = 1, sum = 0;
      while(count <= tom) {
	  sum = sum + count;
	  count = count + 1;
      }
      System.out.print ("the sum of the numbers between 0 and ");
      System.out.println (tom + " is " + sum);
   }
}
