Read about
Fibonacci numbers, the numbers are derived, by calculating the sum of the two previus numbers ie: 0, 1, 1, 2, 3, 5, 8, ....
Or in mathmatical terms: F(n) = {0, 1, F(n-1) + F(n-2)}
So you would start with a prev number assigned the two static values within this, say
prev and
cur, and your program would have a structure like:
Code:
10 prev = 0
20 cur = 1
30 print prev
40 print cur
50 temp = prev
60 prev = cur
70 cur = prev + temp
80 if (condition) goto 40
Now you just use that to create your for() loop, but be sure to read up on Fibonacci numbers, you know, half of Comp. Sci. is the math within.