summaryrefslogtreecommitdiffstats
path: root/01-algorithmic_toolbox/01-intro/01-fibonacci/fibonacci.cpp
blob: adc740454ba7f54ef7c8b676f16df6bc407178a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>

int calc_fib(int n) {
    if (n <= 1)
        return n;

    return calc_fib(n - 1) + calc_fib(n - 2);
}

int main() {
    int n = 0;
    std::cin >> n;

    std::cout << calc_fib(n) << '\n';
    return 0;
}