From dc2122e5f82b5fbb3450aed495998726765a76db Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 15 Dec 2022 19:39:41 +0100 Subject: [PATCH] add factloop from course --- tests/33_fact-loop.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/33_fact-loop.test diff --git a/tests/33_fact-loop.test b/tests/33_fact-loop.test new file mode 100644 index 0000000..78d096e --- /dev/null +++ b/tests/33_fact-loop.test @@ -0,0 +1,12 @@ +int factloop (int n) { + int r = 1; + while (n > 0) { + r = n * r; + n = n - 1; + } + return r; +} + +void main () { + puti(factloop(10)); +}