Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class _08_SumNumbersFromAText {
- @SuppressWarnings("resource")
- public static void main(String[] args) throws FileNotFoundException {
- Scanner input = new Scanner(new File("input.txt"));
- int sum = 0;
- while (input.hasNextLine()) {
- sum += Integer.parseInt(input.nextLine());
- }
- System.out.println(sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement