My problem is that my program doesn't print out the first number in the sequence. Like if i ask it to print out 10 numbers it will only print out 9 numbers and skip the first number that it should start with. example of the output is at the bottom below the code.
#include <iostream>
using namespace std;
int main ()
{
int a[128];
int fN;
int i;
a[0]=1;
a[1]=1;
cout << "How many n terms do you want in the sequence: "
cin >> i;
for ( fN = 2 ; fN <= i ; fN++ )
{
a[fN]=a[fN-1]+a[fN-2];
cout << a[fN] <<"\n";
}
}
Example of the output:
How many n terms do you want in the sequence: 10
2
3
5
8
13
21
34
55
89
Press any key to continue . . .