blob: e144e88894c1a661caf7ee524356d018d3a94f04 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#include <iostream>
unsigned fib(unsigned x) {
if (x <= 1)
return x;
else
return fib(x - 1) + fib(x - 2);
}
int main() {
unsigned n;
std::cin >> n;
std::cout << fib(n) << std::endl;
return 0;
}
|