Implement a recursive function to sum up numbers between two points x, and y.

Implement a recursive function to sum up numbers between two points x, and y.

1
2
3
int sum(x, y){
return helper(total, x, y)
}
If the sum needs to include both x and y then assuming y > x,

1
2
3
4
5
6
int sum( x, y ) {
  if ( x > y )
    return 0;
  else
    return y + sum( x, y - 1 );
}
Topic archived. No new replies allowed.