Skip to content

Commit e8a43f0

Browse files
Added Calculator.java with basic operations (add , sub , mul , dev)
1 parent 693063c commit e8a43f0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Calculator.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class Calculator {
2+
public int add(int a, int b) { return a + b; }
3+
public int subtract(int a, int b) { return a - b; }
4+
public int multiply(int a, int b) { return a * b; }
5+
public int divide(int a, int b) {
6+
if (b == 0) throw new IllegalArgumentException("Cannot divide by zero");
7+
return a / b;
8+
}
9+
}

0 commit comments

Comments
 (0)