diff --git a/dana/programs/factorial.dana b/dana/programs/factorial.dana new file mode 100644 index 0000000..3a56104 --- /dev/null +++ b/dana/programs/factorial.dana @@ -0,0 +1,15 @@ +def main + + def fact is int: n as int + if n <= 1: return: 1 + else: return: n*fact(n-1) + + var input output is int + input := readInteger() + + output := fact(input) + writeString: "The factorial of "; + writeInteger: input + writeString: " is " + writeInteger: output + writeString "\n"