Assignment 124; SumThree
Code
// Donovan Rich
// Period 6
// Summing Three Numbers
// SumThree.java
// 6/9/2016
import java.io.File;
import java.util.Scanner;
public class SumThree {
public static void main(String[] args) throws Exception {
int a, b, c;
System.out.print("Getting name and three numbers from file.....");
Scanner fileIn = new Scanner(new File("3num.txt"));
a = fileIn.nextInt();
b = fileIn.nextInt();
c = fileIn.nextInt();
fileIn.close();
System.out.println(a + " + " + b + " + " + c + " = " + (a+b+c) );
}
}
Picture of the output