progs/fib.while
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 26 Nov 2013 19:54:16 +0000
changeset 205 0b59588d28d2
parent 182 9ce2414e470e
child 207 f824e1331fc6
permissions -rw-r--r--
updated

/* Fibonnacci numbers implemented in 
   the WHILE language */
   
write "Input a number ";
read n;
x := 0;   // start values
y := 1;
while n > 0 do {
  temp := y;
  y := x + y;
  x := temp;
  n := n - 1  // decrement counter
};
write "Result ";
write y