Question: Write a basic recursive function that sums all numbers from 1 to n Please write a simple recursive method recursiveAdd ( ) that adds all
Write a basic recursive function that sums all numbers from to n
Please write a simple recursive method recursiveAdd that adds all integers between the and the input number.
Your method should return the result as an integer.
In the event of a zero or negative input your method should return
Remember, you must have a halting condition so that the recursive function doesn't hang the program.
Recursive functions are useful anytime you must use a previous result of the algorithm for the next iteration of the algorithm.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
