Given the array
static int[] testArray = {8, -5, 22, 17, 4, 9, -12, 15, 23, 25};'
How can I recursively add all the values together. I have tried the below code which of course does not work. As it should and is not very logical as i would not know how to call it
static int[] testArray = {8, -5, 22, 17, 4, 9, -12, 15, 23, 25};
static int i = 0;
public static void reverse(int sum) {
i = i+1;
int sumNum = sum;
//if ((n/10) != 0) {
sumNum = sumNum + testArray[i];
reverse(sum);
//}
}
reverse?