Question: C program (1) Make a function call to recursiveHelloWorld() and observe what happens (2) Modify the recursiveHelloWorld function, so the program can control how many
C program

(1) Make a function call to recursiveHelloWorld() and observe what happens (2) Modify the recursiveHelloWorld function, so the program can control how many "Hello World!" to print. The program will end after outputting the last Hello world! For example, if we call recursiveHelloWorld(5), the program outputs "Hello World!" for five times and successfully ends. Hint: think about what the base case is, and how to modify the recursive function call. Hello World! Hello World! Hello World! Hello World! Hello World! (3) Write a function, i.e., factorial, to calculate the factorial of a positive integer. Use a loop in the function to do it. Assuming only positive integers are passed in. For example, a function call to factorial(5) calculates 5! = 120. 5! 120 (4) Write a recursive version of factorial function instead of using a loop, called recursiveFactorial. Hint: Base case: when the number is 1, the product is 1; Recursive case: 5! = 5 * 4!, 4! = 4 * 3!, etc
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
