// CIS 790 PROF. AUCIELLO // DOWNLOAD THIS TO JDK1.2.2\BIN AND COMPILE WITH JAVAC, // AND RUN WITH JAVA class adddemo { public static void main(String args[]) { int i = 0; int sum = 0; byte buff1[] = new byte[64]; try { System.out.print("Enter End Value: "); System.in.read(buff1, 0, 64); String str1 = new String(buff1,0); String str2 = str1.trim(); int e = Integer.parseInt(str2); for ( i=0; i<=e; i++) { sum = i + sum; System.out.println("i = " + i + " rolling sum = " + sum); } // ends the for loop. System.out.println("The sum of 1 to " + e + " is " + sum); } // ends try clause catch (Exception e) { String err = e.toString(); System.out.println(err); } // end catch. } // ends inner loop } // class