progs/fib.while
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Wed, 23 Oct 2013 01:05:22 +0100
changeset 149 b728c9dbf120
parent 147 4725bba8ef26
child 178 d36363d648e3
permissions -rw-r--r--
add

write "Input a number ";
read n;
x := 0;
y := 1;
while n > 0 do {
  temp := y;
  y := x + y;
  x := temp;
  n := n - 1
};
write "Result ";
write y