Question: Write a c++ program that 1. Does Catalan numbers 2. Do Fibonacci numbers (recursive) 0. Quit Enter selection: 1 Enter Catalan number to calculate: 3
Write a c++ program that
1. Does Catalan numbers
2. Do Fibonacci numbers (recursive)
0. Quit
Enter selection: 1
Enter Catalan number to calculate: 3
Catalan number at 3 is 5
1. Do Catalan numbers
2. Do Fibonacci numbers (recursive)
0. Quit
Enter selection: 2
Enter Fibonacci number to calculate: 6
Fibonacci number 6 is 8
Create a function of catalan that will take a parameter and return the Catalan number. Also create a function of Fibonacci that will take a parameter, calculate using recursion the Fibonacci number and return the number.
Main will have a do/while loop that will print the menu, enter the selection, and call the functions. Have it quit on 0.
Fibonacci are the sequence 1 1 2 3 5 8 13 21
Catalan numbers follow the sequence defined in Chapter 5 of the text. Also, the formula for the Catalan sequence is given here: https://en.wikipedia.org/wiki/Catalan_number (Links to an external site.)Links to an external site.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
