Skip to content

Commit e09547a

Browse files
committed
Added Calculator.java in master merge resloved
2 parents c0918e6 + 191542f commit e09547a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/main/java/com/thealgorithms/Calculator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ public class Calculator {
44
public int add(int a, int b) { return a + b; }
55
public int subtract(int a, int b) { return a - b; }
66
public int multiply(int a, int b) { return a * b; }
7+
<<<<<<< HEAD
78
public double divide(int a, int b) {
89
if (b == 0) throw new ArithmeticException("Divide by zero!");
910
return (double) a / b;
1011
}
12+
=======
13+
public double divide(int a, int b) { return (b != 0) ? (double)a / b : 0; }
14+
>>>>>>> feature/calculator
1115
}

0 commit comments

Comments
 (0)