X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=testub10.git;a=blobdiff_plain;f=gesamt%2Fcodeb_georg_fib_001.0;fp=gesamt%2Fcodeb_georg_fib_001.0;h=17f99e44f2d233e1e13f3bea338b8d4b5aa43559;hp=0000000000000000000000000000000000000000;hb=029401d51612c5e69d7ac8603e1b69cd7ed6ef96;hpb=bf19094ac2573112418701ba4c6abf5779e3a9f7 diff --git a/gesamt/codeb_georg_fib_001.0 b/gesamt/codeb_georg_fib_001.0 new file mode 100644 index 0000000..17f99e4 --- /dev/null +++ b/gesamt/codeb_georg_fib_001.0 @@ -0,0 +1,21 @@ +/* fibonacci */ + +/* F_0 = 0 */ +/* F_1 = 1 */ +/* F_n = F_{n-1} + F_{n-2} */ + +method fib() + if this < 2 then return this; end; + var a := 0; + var b := 1; + var c := this; + var x := this; + while not (x < 2) + do + c := a-(0-b); + a := b; + b := c; + x := x-1; + end; + return c; +end;