-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
27 lines (23 loc) · 917 Bytes
/
Main.java
File metadata and controls
27 lines (23 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Simple Calculator Program
// Task: Complete the function addNumbers so it returns the sum of two numbers
// The program reads two integers from input.txt and writes the sum to output.txt
// Simple Calculator Program
// Task: Complete the function addNumbers so it returns the sum of two numbers
// The program reads two integers from input.txt and writes the sum to output.txt
import java.io.*;
import java.util.*;
public class Main {
static int addNumbers(int a, int b) {
// TODO: fix this function
return 0; // placeholder, replace with correct code
}
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(new File("input.txt"));
PrintWriter out = new PrintWriter("output.txt");
int a = sc.nextInt();
int b = sc.nextInt();
int result = addNumbers(a, b);
out.println(result);
out.close();
}
}