import java.io.*; public class sum_for { public static void main (String[] args) throws IOException { InputStreamReader reader = new InputStreamReader (System.in); BufferedReader input = new BufferedReader (reader); System.out.println (); System.out.print ("Specify a sequence of integers, "); System.out.print ("where the first integer specifies how many more integers will follow"); System.out.println (); System.out.println (); int total = 0; int iterations = Integer.parseInt (input.readLine ()); for (int i = 0; i < iterations; i++) { int current_value = Integer.parseInt (input.readLine ()); total += current_value; } System.out.println (); System.out.println ("The total of " + iterations + " number(s) is: " + total); System.out.println (); } }