Advertisement
enevlogiev

JavaHWproblem

Jan 27th, 2015
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.FileNotFoundException;
  3. import java.util.Scanner;
  4.  
  5. public class _08_SumNumbersFromAText {
  6.     @SuppressWarnings("resource")
  7.     public static void main(String[] args) throws FileNotFoundException {
  8.         Scanner input = new Scanner(new File("input.txt"));
  9.         int sum = 0;
  10.         while (input.hasNextLine()) {
  11.             sum += Integer.parseInt(input.nextLine());
  12.         }
  13.         System.out.println(sum);
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement