Added my works from 2022
This commit is contained in:
17
alg_4_2.cpp
Normal file
17
alg_4_2.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int fib(int n)
|
||||
{
|
||||
if (n == 0) { return 1; }
|
||||
if (n == 1) { return 1; }
|
||||
|
||||
return fib(n - 1) + fib(n - 2);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int n; cin >> n;
|
||||
|
||||
cout << fib(n);
|
||||
}
|
||||
Reference in New Issue
Block a user