-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathArithmetic.java
More file actions
30 lines (23 loc) · 685 Bytes
/
Arithmetic.java
File metadata and controls
30 lines (23 loc) · 685 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
package com.codefortomorrow.beginner.chapter4.examples;
public class Arithmetic {
public static void main(String[] args) {
// addition
int a = 5 + 1;
System.out.println("a is " + a);
// subtraction
double b = 25.6 - 90;
System.out.println("b is " + b);
// multiplication
int c = 12 * 4;
System.out.println("c is " + c);
// integer division
int d = 10 / 3;
System.out.println("d is " + d);
// double division
double e = 10.0 / 3;
System.out.println("e is " + e);
// modulus
int f = 10 % 3;
System.out.println("f is " + f);
}
}