Question: In Java, You will create a recursive function and an iterative function for each of the following problems. Write a function that takes an integer

In Java,
You will create a recursive function and an iterative function for each of the following problems.
Write a function that takes an integer n and returns the sum of the first n natural numbers. The first n natural numbers are defined as positive integers less than or equal to n. For example, the sum of the first 5 natural numbers is 1+2+3+4+5=15.
Write a function that takes an integer n and returns the nth number in the sequence 1,1,2,4,7,13,24,44,... where each number is the sum of the three preceding it.
Write a function that takes an integer n and returns the product of the first n even numbers. For example, the product of the first 5 even numbers is 2*4*6*8*10=3840.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!