-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathBasicMath.java
More file actions
37 lines (29 loc) · 935 Bytes
/
BasicMath.java
File metadata and controls
37 lines (29 loc) · 935 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
37
package chapter4;
public class BasicMath {
public static void main(String args[]) {
// Arithmetic using integer..
System.out.println("Integer Arithmetic");
int a = 1 + 1;
int b = a * 3;
int c = b / 4;
int d = c - a;
int e = -d;
System.out.println("a= " + a);
System.out.println("b= " + b);
System.out.println("c= " + c);
System.out.println("d= " + d);
System.out.println("e= " + e);
// Arithmetic using doubles..
System.out.println("Floating point Arithmetic");
double da = 1 + 1;
double db = da * 3;
double dc = db / 4;
double dd = dc - a;
double de = -dd;
System.out.println("da= " + da);
System.out.println("db= " + db);
System.out.println("dc= " + dc);
System.out.println("dd= " + dd);
System.out.println("de= " + de);
}
}