Question: USE C programming (test it before upload it) Q2) Consider the function f(n) = 5f(n1)6f(n2), n 2, f(0) = 0, f(1) = 1. Write a

USE C programming (test it before upload it)

Q2) Consider the function f(n) = 5f(n1)6f(n2), n 2, f(0) = 0, f(1) = 1. Write a program that calculates f(n) recursively.

At the start of the program, prompt the user to input an integer number by printing "Input an integer: ". If the input is negative, then print "Input must be nonnegative. ". If the input is nonnegative, then print the value of f(n) as "f() = ", where and are replaced with the values of n and f(n), respectively.

You should use the following function prototype:

 int recursiveFunc(int n); 

Example input/output pairs (without the prompt) are provided below.

(a) Input: 0; Output: f(0) = 0 (b) Input: 1; Output: f(1) = 1

(c) Input: 3; Output: f(3) = 19

(d) Input: 4; Output: f(4) = 65 Note: Include all of your code in one file named recursion.c.

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!