progs/fib.while
changeset 272 1446bc47a294
parent 215 828303e8e4af
child 275 618c7640cf66
equal deleted inserted replaced
271:b9b54574ee41 272:1446bc47a294
     1 /* Fibonacci Program
     1 /* Fibonacci Program
     2    input: n */
     2    input: n */
     3 
     3 
     4 write "Fib";
     4 write "Fib";
     5 read n;   // n := 19;
     5 read n;  
     6 minus1 := 0;
     6 minus1 := 0;
     7 minus2 := 1;
     7 minus2 := 1;
     8 while n > 0 do {
     8 while n > 0 do {
     9        temp := minus2;
     9        temp := minus2;
    10        minus2 := minus1 + minus2;
    10        minus2 := minus1 + minus2;