cwtests/cw04/fib.while
changeset 852 8706b846a3e0
parent 836 a3418ee8c404
child 859 f766d3486c9d
equal deleted inserted replaced
851:48539905c447 852:8706b846a3e0
     1 write "Fib";
     1 write "Fib";
     2 read n;
     2 read n;
     3 minus1 := 0;
     3 minus1 := 0;
     4 minus2 := 1;
     4 minus2 := 1;
     5 while n > 0 do {
     5 while n > 0 do {
     6 temp := minus2;
     6   temp := minus2;
     7 minus2 := minus1 + minus2;
     7   minus2 := minus1 + minus2;
     8 minus1 := temp;
     8   minus1 := temp;
     9 n := n - 1
     9   n := n - 1
    10 };
    10 };
    11 write "Result";
    11 write "Result";
    12 write minus2
    12 write minus2