-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathArithmeticOperators.java
More file actions
39 lines (32 loc) · 1.13 KB
/
ArithmeticOperators.java
File metadata and controls
39 lines (32 loc) · 1.13 KB
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
package example.oo.main;
public class ArithmeticOperations {
public static void main (String args[]){
//sum
int numberA= 1500000000;
int numberB=1500000000;
int numberC=numberA+numberB;
long numberD=numberA+numberB;
System.out.println("int variable: "+numberC);
System.out.println("long variable: "+numberD);
numberD=numberA;
numberD+=numberB;
System.out.println("long variable: "+numberD);
//division
numberA=39;
numberB=4;
numberC=numberA/numberB;
System.out.println("Division int: "+numberC);
float floatA=numberA/numberB;
System.out.println("Division float with integer ops: "+floatA);
float floatB=39;
float floatC=4;
floatA=floatB/floatC;
System.out.println("Division float with float ops: "+floatA);
//multiplication
floatA=floatB*floatC;
System.out.println("Multiplication output: "+floatA);
//subtraction
floatA=floatB-floatC;
System.out.println("Subtraction output: "+floatA);
}
}