-
Notifications
You must be signed in to change notification settings - Fork 0
/
LabTest1Max.java
41 lines (34 loc) · 1.07 KB
/
LabTest1Max.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
29
30
31
32
33
34
35
36
37
38
39
40
41
package labtest.LabTest1Max;
import java.util.Scanner;
public class LabTest1Max {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int totalLoop = sc.nextInt();
double num1 = 0;
double num2 = 0;
double output = 0;
for (int i = 0; i < totalLoop; i++) {
num1 = sc.nextDouble();
num2 = sc.nextDouble();
// first condition
if (num1 > num2 && num2 != 0) {
output = num1 - num2;
System.out.println(num1 + "-" + num2 + "=" + output);
}
// second condition
if (num2 == 0) {
output = num1 * 2;
System.out.println(num1 + "*2=" + output);
}
// third condition
if (num1 < num2 && num1 != 0) {
output = num2 / num1;
System.out.println(num2 + "/" + num1 + "=" + output);
}
// fourth condition
if (num1 == 0) {
break;
}
}
}
}