/*
   TestWhile.java: Test the while loop
*/
//package Chapter3;

//import Chapter2.MyInput;

public class TestWhile
{
  // Main method
  public static void main(String[] args)
  {
    int data;
    int sum = 0;

    // Read an initial data
    System.out.println("Enter an int value");
    data = MyInput.readInt();

    // Keep reading data until the input is 0
    while (data != 0)
    {
      sum += data;

      System.out.println(
        "Enter an int value, the program exits if the input is 0");
      data = MyInput.readInt();
    }

    System.out.println("The sum is "+sum);
  }
}

