progs/fib.while
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Wed, 27 Nov 2013 08:49:51 +0000
changeset 207 f824e1331fc6
parent 182 9ce2414e470e
child 208 bd5a8a6b3871
permissions -rw-r--r--
added slides

/* Fibonacci Program
   input: n
*/
//write "Fib";
read n;
//n := 19;
minus1 := 0;
minus2 := 1;
while n > 0 do {
       temp := minus2;
       minus2 := minus1 + minus2;
       minus1 := temp;
       n := n - 1
};
write "Result";
write minus2