Skip to content

Commit 19e5ae9

Browse files
mathematical operations in Java
Addition, sub, multiplication, division increment operator
1 parent 2f9663b commit 19e5ae9

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed
1.33 KB
Binary file not shown.
152 Bytes
Binary file not shown.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package clasi;
2+
3+
public class Caluculator {
4+
5+
public static void main(String[] args) {
6+
// Math operator
7+
int x, y, ans;
8+
x = 1;
9+
y = 2;
10+
ans = x * y;
11+
int aans = x + y;
12+
double ans1 = x % y;
13+
float ans2 = x / y;
14+
15+
System.out.println("Answer is = " + ans);
16+
System.out.println("Answer is = " + aans);
17+
System.out.println("Answer is = " + ans1);
18+
System.out.println("Answer is = " + ans2);
19+
20+
// incrementation
21+
22+
int x1 = 10;
23+
x1 *= 5;
24+
25+
// x++;
26+
System.out.println(x1++);
27+
System.out.println(x1);
28+
29+
System.out.println(x1);
30+
31+
32+
33+
34+
}
35+
36+
}

MathOperators/src/module-info.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
*
3+
*/
4+
/**
5+
*
6+
*/
7+
module MathOperators {
8+
}

0 commit comments

Comments
 (0)