It’s because your sumNumbers
method has return 0
at the end of it.
Simply remove that and put return sumNumbers(sum + numbers[count], numbers, count + 1);
at the end of it instead.
solved Why is that the recursive function prints the correct value but the cout statement right after the call does not? [closed]