diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-19 23:33:08 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-19 23:33:08 +0000 |
commit | 2ba77a78a37448eeeff59ed10fff06676b911fb7 (patch) | |
tree | 4b14c55fccf8bfb397106186911bc21747c293f1 | |
parent | 10ebdec39f27c92e6e23c7a973c91ed1b1090401 (diff) | |
download | Compiler-2ba77a78a37448eeeff59ed10fff06676b911fb7.tar.gz Compiler-2ba77a78a37448eeeff59ed10fff06676b911fb7.zip |
Making recursion nicer
-rw-r--r-- | c_compiler/test/in/recursion.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/c_compiler/test/in/recursion.c b/c_compiler/test/in/recursion.c index 8a1a170..734220a 100644 --- a/c_compiler/test/in/recursion.c +++ b/c_compiler/test/in/recursion.c @@ -1,12 +1,11 @@ int fact(int n) { - if(n <= 1) { + if(n <= 1) return 1; - } else { + else return fact(n-1) * n; - } } int main() { - return fact(5); + return fact(5) + fact(2) + fact(1); } |