By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two;
for example, the first 6 Fibonacci numbers are 0, 1, 1, 2, 3, 5.
Write a program that asks the user for a number between 5 and 11 (inclusive) and then displays that many Fibonacci numbers.
YOU MUST write a function called fibonacci which is called from main as follows:
if ((num < 5) || (num > 11)) cout "Please follow the directions!" endl; else { total = fibonacci(num); cout << endl; cout << "Total is "; cout << total; cout << endl; }
Note that the function adds up each of the Fibonacci numbers and returns the total to main.