I have a simple problem and the statement goes like this:
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... I want to create the numbers as above:
The code that I am trying to write is as follows:
num(1)=1
num(2)=2
for i in range(3,10):
num(i)=num(i-1)+num(i-2)
print num(i)
The algorithm that I designed is as follows:
x(i)=x(i-1)+x(i-2)
I will start from x(3) with x(1) and x(2) unknown. Can anyone help me with in array syntax error ? Thanks.