diff options
Diffstat (limited to 'development/obcpl/examples/factorial.b')
-rw-r--r-- | development/obcpl/examples/factorial.b | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/development/obcpl/examples/factorial.b b/development/obcpl/examples/factorial.b new file mode 100644 index 0000000000..c6ea911cc3 --- /dev/null +++ b/development/obcpl/examples/factorial.b @@ -0,0 +1,9 @@ +GET "LIBHDR" + +LET START() = VALOF $( + FOR I = 1 TO 5 DO + WRITEF("%N! = %I4*N", I, FACT(I)) + RESULTIS 0 +$) + +AND FACT(N) = N = 0 -> 1, N * FACT(N - 1) |