From: Doni Pracner Date: Sun, 9 Feb 2014 00:05:03 +0000 (+0100) Subject: new sample - Recursive Factoriel X-Git-Tag: v0.1.5~10 X-Git-Url: http://svarog.pmf.uns.ac.rs/gitweb/?p=mjc2wsl.git;a=commitdiff_plain;h=6ba7e8efcd800adf5d3bbc0c4113d2d3a3670ddb;ds=sidebyside new sample - Recursive Factoriel --- diff --git a/samples/RekFac.mj b/samples/RekFac.mj new file mode 100644 index 0000000..40817fd --- /dev/null +++ b/samples/RekFac.mj @@ -0,0 +1,15 @@ +program RekFac{ + + int factorial(int f) + { + if (f<0) return 0; + if (f<=1) return 1; + return factorial(f-1) * f ; + } + + void main() + { + print(factorial(3),3); + print(factorial(10),10); + } +} \ No newline at end of file