Assignment #124 and Summing Three Numbers
Code
/// Name: Ali Kurland
/// Period: 6
/// Program Name: Summing Three Numbers
/// File Name: ThreeNumbers.java
/// Date Finished: 5/12/2016
import java.io.File;
import java.util.Scanner;
public class ThreeNumbers {
public static void main(String[] args) throws Exception {
int a, b, c, sum;
System.out.println("Reading numbers from file \"3nums.txt\".... done.");
Scanner fileIn = new Scanner(new File("3nums.txt"));
a = fileIn.nextInt();
b = fileIn.nextInt();
c = fileIn.nextInt();
fileIn.close();
sum = a + b + c;
System.out.println(a + " + " + b + " + " + c + " = " + sum);
}
}
Picture of the output