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