Write a recursive function rec_sum() that takes some natural number n as its input and outputs the sum of first n natural numbers.
This problem is very similar to that of finding a factorial, so we are sure that you'll be able to get it right!
Write a recursive function rec_sum() that takes some natural number n as its input and outputs the sum of first n natural numbers.
This problem is very similar to that of finding a factorial, so we are sure that you'll be able to get it right!
Sample Input 1:
1Sample Output 1:
1Create a free account to access the full topic