import java.lancs.BasicIo; public class sum_while { public static void main (String[] args) throws Exception { System.out.println (); System.out.print ("Specify a sequence of integers, "); System.out.print ("where the end of the sequence is indicated by the number -1"); System.out.println (); System.out.println (); int total = 0; int iterations = 0; while (true) { int current_value = BasicIo.readInteger (); if (current_value == -1) break; total += current_value; iterations++; } System.out.println (); System.out.println ("The total of " + iterations + " number(s) is: " + total); System.out.println (); } }