C Problem Recursion Write Recursive Program Computes Following Function Ff X Ff X X Ff X Q37054651

C++

Problem: Recursion

Write a recursive program that computes the following function,ff(x).

ff(x) = x * ff(x/2); if x is even

ff(x) = x * ff(x-2); if x is odd

ff(1) = ff(0) = 1

Your program should prompt the user to input x and should checkthat it is a positive integer.   Then print the value ofx each time the recursive function is called and print the valuereturned each time the recursive function returns so that you cansee how the execution path and values of the function as itcomputes. Finally, your main() should print the final answer.

Example Output

(user input)

Please enter a value of x: 16

Beginning calculation

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.