forked from AndrewProgramming/JavaTutorialCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMathOperatorDemo.java
More file actions
36 lines (27 loc) · 859 Bytes
/
MathOperatorDemo.java
File metadata and controls
36 lines (27 loc) · 859 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
28
29
30
31
32
33
34
35
36
package basic;
public class MathOperatorDemo {
public static void main(String[] args) {
int a = 10, b = 5;
System.out.println(a + b);
System.out.println(a - b);
System.out.println(a * b);
System.out.println(a / b);
System.out.println(a % b);
System.out.println("=======================");
double d1 = 35.0D, d2 = 5.0D;
System.out.println(d1 + d2);
System.out.println(d1 - d2);
System.out.println(d1 * d2);
System.out.println(d1 / d2);
System.out.println(d1 % d2);
System.out.println("=======================");
System.out.println(d1 + b);
System.out.println(d1 - b);
System.out.println(d1 * b);
System.out.println(d1 / b);
System.out.println(d1 % b);
System.out.println("=======================");
System.out.println(-7 % 3);
System.out.println(7 % -3);
}
}