-
Notifications
You must be signed in to change notification settings - Fork 0
/
tri.java
28 lines (20 loc) · 1.33 KB
/
tri.java
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
28
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String[] strings = scanner.nextLine().split(" ");
int first = Integer.parseInt(strings[0]);
int second = Integer.parseInt(strings[1]);
int third = Integer.parseInt(strings[2]);
if (first + second == third) { System.out.println(String.format("%d+%d=%d", first, second, third)); }
else if (first - second == third) { System.out.println(String.format("%d-%d=%d", first, second, third)); }
else if (first * second == third) { System.out.println(String.format("%d*%d=%d", first, second, third)); }
else if (first / second == third) { System.out.println(String.format("%d/%d=%d", first, second, third)); }
else if (second + third == first) { System.out.println(String.format("%d=%d+%d", first, second, third)); }
else if (second - third == first) { System.out.println(String.format("%d=%d-%d", first, second, third)); }
else if (second * third == first) { System.out.println(String.format("%d=%d*%d", first, second, third)); }
else if (second / third == first) { System.out.println(String.format("%d=%d/%d", first, second, third)); }
}
}