diff options
| author | 2025-11-16 12:11:18 +0100 | |
|---|---|---|
| committer | 2025-11-16 12:11:18 +0100 | |
| commit | 111e71e1511b2abff9176bd6c714c8da796f770e (patch) | |
| tree | 352b723c9144c844037447bd865a8366378df7a5 /test/04-fact.c | |
| parent | b0c0f2d2d885c5901de08ed08dba9fff079bf6e3 (diff) | |
basic automated testing
Diffstat (limited to 'test/04-fact.c')
| -rw-r--r-- | test/04-fact.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/04-fact.c b/test/04-fact.c new file mode 100644 index 0000000..0982e08 --- /dev/null +++ b/test/04-fact.c @@ -0,0 +1,17 @@ +/* EXPECT: +6! = 720 +*/ + +int +fact(int x) +{ + int y = 1; + while (x >= 1) { + y *= x; + x -= 1; + } + return y; +} + +extern int printf(); +int main() { printf("6! = %d\n", fact(6)); } |