From 7b21727285e50b0b050c4ddd70d07542229c5366 Mon Sep 17 00:00:00 2001 From: pants Date: Mon, 21 Sep 2026 14:17:03 -0700 Subject: init --- c/factorial.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 c/factorial.c (limited to 'c/factorial.c') diff --git a/c/factorial.c b/c/factorial.c new file mode 100644 index 0000000..4ee0720 --- /dev/null +++ b/c/factorial.c @@ -0,0 +1,18 @@ +#include + +long fact(long n) { + if (n == 0) { + return 1; + } + else return(n*fact(n-1)); +} + +int main() { + printf("enter a POSITIVE integer... "); + long input; + scanf("%d", &input); + long output = fact(input); + printf("output: %lld\n", output); + + return 0; +} -- cgit v1.2.3