Cheers man. I'll give it a shot.
Much appreciated.
Type: Posts; User: ManInTheMiddle
Cheers man. I'll give it a shot.
Much appreciated.
No, when I run this code I get 13. The code is right I'm just finding it hard to understand the logic behind it.
I understand how it works (kind of) just what happens when it gets passed through...
I understand how the div and mod works. What I'm having trouble with is when it comes in for the first time.
256 / 10 = 25
256 % 10 = 6
which is 31.
Hi,
I have a recursive method to find the sum of a given number that's greater than 10 respectively.
static int sum(int n) {
if(n < 10) {
return n;