Question: Write a C++ program that generates a Fibonacci sequence, or calculates the nth element of a Fibonacci sequence based on the user selection. Your program

Write a C++ program that generates a Fibonacci sequence, or calculates the nth element of a Fibonacci sequence based on the user selection. Your program should prompt the user for two options. The first option will prompt the user for an integer, generate the number of a Fibonacci sequence, and print the result based on the user input. The second option will prompt the user for an integer, calculate the nth element of a Fibonacci sequence, and print the result based on the user input (see the sample output below). Sample output Welcome to the Fibonacci sequence Generator! (1)Generate a Fibonacci sequence (2)Find the nth element of a Fibonacci sequence Choose an option (Enter 1 or 2): 1 Enter the number of a Fibonacci sequence to be generated: 10 0112 3 5 8 13 21 34 Would you like to use the generator again (y)? y Welcome to the Fibonacci sequence Generator! (1) Generate a Fibonacci sequence (2) Find the nth element of a Fibonacci sequence Choose an option (Enter 1 or 2): 2 Enter the nth element of a Fibonacci sequence to be calculated, F(n): 4 The Fibonacci number, F(8) is : 2 Would you like to use the generator again (y)?n Thank you for using this program. Goodbye
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
