-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicMath.java
More file actions
30 lines (29 loc) · 832 Bytes
/
BasicMath.java
File metadata and controls
30 lines (29 loc) · 832 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
//Demonstrate of basic arithematic operators.
class BasicMath{
public static void main(String args[]){
//arithematic using integers.
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);
//arithematic using doubles.
System.out.println("\nFloating Point Arithematic");
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);
}
}