progs/fib.while
changeset 208 bd5a8a6b3871
parent 207 f824e1331fc6
child 211 deece8c6cf3a
equal deleted inserted replaced
207:f824e1331fc6 208:bd5a8a6b3871
     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;