L11 - B

public
yeskendir.sultanov Mar 29, 2024 Never 133
Clone
C++ l11b.cpp 18 lines (15 loc) | 261 Bytes
1
#include <bits/stdc++.h>
2
3
using namespace std;
4
5
int fib(int n) {
6
if (n <= 1) {
7
return n;
8
} else {
9
return fib(n - 2) + fib(n - 1);
10
}
11
}
12
13
int main() {
14
int n;
15
cin >> n;
16
cout << fib(n);
17
return 0;
18
}
19
20
21