n = 1
f0 = 0
f1 = 1
print 0
if n>1: print 1
for i in range (n-2):
--- fn = f0 + f1
--- print fn
--- f0 = f1
--- f1 = fn
"Please read about the Fibonacci numbers at
http://en.wikipedia.org/wiki/Fibonacci_number
then write a program, and save it in lab02.cpp, that asks how many
numbers it should generate in the Fibonacci series.
Remember that the first two numbers are
0 and 1
so you already have two numbers in the series when you start.
Please write a function named Fibonacci that takes an int indicating
the length of the series. The function prototype could look like
void Fibonacci( int length );
Use a local array of size 20 to store the sequence of numbers and
then print the sequence in reverse order (largest number first);
display 6 numbers per line and use 5 positions for each number;
if the user asked for 20 numbers, your program should display
4181 2584 1597 987 610 377
233 144 89 55 34 21
13 8 5 3 2 1
1 0
Your program should make sure that length the series (i.e., the
int being passed to the Fibonacci function) is >= 2 and <= 20;
otherwise your program should display a message that length is out of
bounds and terminate the execution"
My code so far:
"
#include
#include
using namespace std;
void Fibonacci( int );
int main( )
{
cout << "how many numbers in the Fibonacci Series? ";
int n; // n numbers in the Fibonacci Series
cin >> n;
Fibonacci( n );
return 0;
}"
I am stuck as to what to do next, please help :C