aboutsummaryrefslogtreecommitdiff
path: root/src/fac.mil
diff options
context:
space:
mode:
Diffstat (limited to 'src/fac.mil')
-rw-r--r--src/fac.mil13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/fac.mil b/src/fac.mil
new file mode 100644
index 0000000..3e19aa8
--- /dev/null
+++ b/src/fac.mil
@@ -0,0 +1,13 @@
1/* fac.mil --- compute factorial of a number -*- MiLan -*- */
2FUNC fac (1) RETURNS;
3
4BEGIN
5 WRITE (fac (READ))
6END
7
8FUNC fac (n) RETURNS
9BEGIN
10 IF n = 0 THEN RETURN 1 FI;
11 RETURN (n*fac (n - 1))
12END
13/* fac.mil end here */