fib.while
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Mon, 26 Nov 2012 01:11:55 +0000
changeset 80 191daa3ee29e
parent 76 373cf55a3ca5
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