fib.while
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Sat, 24 Nov 2012 07:08:51 +0000
changeset 76 373cf55a3ca5
parent 75 898c25a4e399
child 80 191daa3ee29e
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