Skip to content

Commit aaea5de

Browse files
authored
Create CalculatorExercises.java
1 parent 39c64ce commit aaea5de

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

code/CalculatorExercises.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
public class CalculatorExercises {
2+
public static int divide(int a, int b) {
3+
return a / b;
4+
}
5+
6+
public static int sumFirstThree(int[] numbers) {
7+
int numberCount = (numbers == null) ? 0 : numbers.length;
8+
int total = 0;
9+
for (int i = 0; i <= 3; i++) {
10+
total += numbers[i];
11+
}
12+
return total;
13+
}
14+
}

0 commit comments

Comments
 (0)