progs/fib.while
changeset 211 deece8c6cf3a
parent 208 bd5a8a6b3871
child 215 828303e8e4af
equal deleted inserted replaced
210:33175abd5474 211:deece8c6cf3a
     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;
     6 n := 19;
     6 //n := 19;
     7 minus1 := 0;
     7 minus1 := 0;
     8 minus2 := 1;
     8 minus2 := 1;
     9 while n > 0 do {
     9 while n > 0 do {
    10        temp := minus2;
    10        temp := minus2;
    11        minus2 := minus1 + minus2;
    11        minus2 := minus1 + minus2;