fib.while
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Wed, 28 Nov 2012 00:06:03 +0000
changeset 81 ffac240147e2
parent 80 191daa3ee29e
child 83 bd61b03b9eaa
permissions -rw-r--r--
tuned

/* Fibonacci Program
   input: n
   output: fib_res */

n := 90;
minus1 := 0;
minus2 := 1;
temp := 0;
while n > 0 do {
       temp := minus2;
       minus2 := minus1 + minus2;
       minus1 := temp;
       n := n - 1
};
fib_res := minus2;
write fib_res