5 // Purpose: to sum the integers from stdin
6 // Author: pc2@ecs.csus.edu or http://www.ecs.csus.edu/pc2
8 // Thu Oct 2 20:25:28 PDT 2003
10 // $Id: isumit.java,v 1.1 2005/03/06 05:34:39 laned Exp $
14 public static void main(String
[] args
)
18 BufferedReader br
= new BufferedReader (
19 new InputStreamReader (System
.in
), 1);
24 while((line
= br
.readLine()) != null)
26 rv
= new Integer(line
.trim()).intValue();
29 // System.out.println(line);
31 System
.out
.print("The sum of the integers is ");
32 System
.out
.println(sum
);
36 System
.out
.println("Possible trouble reading sumit.dat");
37 System
.out
.println("Message: "+ e
.getMessage());
42 // eof isumit.java $Id: isumit.java,v 1.1 2005/03/06 05:34:39 laned Exp $