changeset 75 | 898c25a4e399 |
parent 73 | 27469183da75 |
child 76 | 373cf55a3ca5 |
--- a/fib.while Fri Nov 23 19:31:37 2012 +0000 +++ b/fib.while Fri Nov 23 21:21:27 2012 +0000 @@ -1,12 +1,22 @@ -{ n := 9; - minus1 := 0; - minus2 := 1; - temp := 0; - while n > 0 do { +/* + + Fibonacci Program + + input: n + output: fib_res + +*/ + +n := 9; +minus1 := 0; +minus2 := 1; +temp := 0; +while n > 0 do { temp := minus2; minus2 := minus1 + minus2; minus1 := temp; n := n - 1 - }; - fib_res := minus2 -} +}; +fib_res := minus2; +print fib_res +