Question: In C++, Suppose you have a function, myfib, declared as follows: int myfib(const int n) which returns the nth Fibonacci number, using this function: (a)
In C++,
Suppose you have a function, myfib, declared as follows: int myfib(const int n) which returns the nth Fibonacci number, using this function:
(a) Write a function, myfibseries, that also takes a single parameter, n, and prints out the entire sequence of Fibonacci numbers up to and including n, with a comma between each (do NOT use loops).
(b) Write a function, myfibseriesR, that also takes a single parameter, n, and prints out the entire sequence of Fibonacci numbers up to and including n, with a comma between each, but in REVERSE order (do NOT use loops).
(c) Write a function, myfibsum, that takes a single parameter, n, and prints out the sum of all the Fibonacci numbers up to and including n (do NOT use loops).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
