This function is a recursion function that sums all the values from 0 to n.It accepts one parameter which is the value to sum to inclusively.
I know now how to do this using a for loop, but not using a recursion function
please help
let's say that your functions it's called Sn()
define your base case, for example: Sn(0) = 0
reduce your problem Sn(n) = n + Sn(n-1)
What on Earth is Recursion? - Computerphile
https://www.youtube.com/watch?v=Mv9NEXX1VHc
Last edited on