/*
	The program reads the Number.txt
	It will sums up all the number inside it
	Then it outputs to the screen
	
*
*/

import java.util.*;
import java.io.*;

public class FileNum
{
	public static void main(String[] args)throws IOException
	{
		Scanner key = new Scanner(System.in);
		
		int sum = 0;
		
		// Gets the name of the file
		
		System.out.println("Enter file name: ");
		String filename = key.nextLine();
		
		// Opens the file
		
		File file = new File(filename);
		Scanner input = new Scanner(file);
		
		/*
			Reads until the end of file
			Sums up all the number
		*
		*/
		
		while(input.hasNext())
		{
			int number = input.nextInt();
			
			sum += number;
			
		}
		
		input.close();
		
		System.out.println("The sum of the number is " + sum);
	}
}
		
