Turing Help
Posted: Thu Feb 16, 2006 11:05 pm
I'm trying to code out a simple program to display the first 20 numbers of Fibonacci's Number (1,1,2,3,5,8,13... *1+1 =2.. 2+1=3.. 3+2=5.. 5+3=8.. etc...*) Can anyone tell me why it isn't adding properly> I can get the program to display 1,1,2,3,5,8.. but then the rest isn't working properly. ^^;; This is what I have so far:
Code: Select all
var number : int := 1
var sum : int
var sum2 : int
sum := number + number
sum2 := number + sum
put number,", ",number, ", " ..
put sum, ", " ..
put sum2, ", " ..
for i : 1 .. 20
number := sum + sum2
sum2 := sum2 + sum2
put number , ", " ..
end for[code]
[color=#888888][size=85]Archived topic from Iceteks, old topic ID:4184, old post ID:34055[/size][/color]