fib.while
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Fri, 23 Nov 2012 19:28:10 +0000
changeset 73 27469183da75
child 75 898c25a4e399
permissions -rw-r--r--
tuned
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
73
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
{ n := 9;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     2
     minus1 := 0;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     3
     minus2 := 1;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
     temp := 0;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     5
     while n > 0 do  {
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     6
       temp := minus2;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     7
       minus2 := minus1 + minus2;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
       minus1 := temp;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     9
       n := n - 1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    10
     };
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    11
     fib_res := minus2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    12
}