changeset 178 | d36363d648e3 |
parent 147 | 4725bba8ef26 |
child 182 | 9ce2414e470e |
--- a/progs/fib.while Fri Nov 01 23:19:45 2013 +0000 +++ b/progs/fib.while Sun Nov 03 00:41:24 2013 +0000 @@ -1,12 +1,15 @@ +/* Fibonnacci sequence implemented in + the WHILE language */ + write "Input a number "; read n; -x := 0; +x := 0; // start values y := 1; while n > 0 do { temp := y; y := x + y; x := temp; - n := n - 1 + n := n - 1 // decrement counter }; write "Result "; write y