From 0cabbd2a0853c332c82af621b8716643741d758a Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Tue, 21 Jul 2026 14:36:02 -0700 Subject: more faithful grammar --- test/factorial.c | 8 ++++++++ test/factorial2.c | 7 +++++++ test/fibonacci.c | 8 -------- test/fibonacci2.c | 8 -------- 4 files changed, 15 insertions(+), 16 deletions(-) create mode 100644 test/factorial.c create mode 100644 test/factorial2.c delete mode 100644 test/fibonacci.c delete mode 100644 test/fibonacci2.c (limited to 'test') diff --git a/test/factorial.c b/test/factorial.c new file mode 100644 index 0000000..0525b8f --- /dev/null +++ b/test/factorial.c @@ -0,0 +1,8 @@ +int fact (int n) { + if (n) return n * fact(n-1); + else return 1; +} + +int main (int argc, char** argv) { + return fact(argc); +} diff --git a/test/factorial2.c b/test/factorial2.c new file mode 100644 index 0000000..867b709 --- /dev/null +++ b/test/factorial2.c @@ -0,0 +1,7 @@ +int main (int argc, char** argv) { + int result = 1; + for (int n = argc; n; n = n - 1) { + result = result * n; + } + return result; +} diff --git a/test/fibonacci.c b/test/fibonacci.c deleted file mode 100644 index a07c111..0000000 --- a/test/fibonacci.c +++ /dev/null @@ -1,8 +0,0 @@ -int fib (int n) { - if (n) return n * fib(n-1); - else return 1; -} - -int main (int argc, char** argv) { - return fib(argc); -} diff --git a/test/fibonacci2.c b/test/fibonacci2.c deleted file mode 100644 index b8adb9a..0000000 --- a/test/fibonacci2.c +++ /dev/null @@ -1,8 +0,0 @@ -int main (int argc, char** argv) { - int n = argc; - int result = 1; - for (; n; n = n - 1) { - result = result * n; - } - return result; -} -- cgit v1.2.3