aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/recursive_functions.c
blob: b81824a83f6a745b642db06f9964916d6c24dc69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <helpers.h>

int fib(int n) {
    if (n <= 1) {
        return 1;
    } else {
        return fib(n - 1) + fib(n - 2);
    }
}

int main() {
    ASSERT_EQ(89, fib(10));
}