Write a C++ program that calculates the factorial of a number using recursion.
Tasks:
- Implement a recursive function int factorial(int n) that returns the factorial of n.
- Write a main function to test your recursive factorial function with several test cases.
- Provide a detailed analysis of the time complexity of your recursive function.
- Explain why recursion is appropriate for this problem and discuss any potential limitations or issues with recursion in general (e.g., stack overflow for large n).
For this C++ assignment, submit a word document or PDF with screenshots of the working code snippets and the successful output of the program.

Leave a Reply
You must be logged in to post a comment.