Untitled
unknown
plain_text
3 years ago
295 B
5
Indexable
#include <iostream>
#include <fstream>
using namespace std;
int fib(int n) {
int f;
if (n == 0) return 0;
if (n == 1) return 1;
return fib(n - 1) + fib(n - 2);
}
int main()
{
setlocale(LC_ALL, "Russian");
ifstream in("input.txt");
int n;
in >> n;
cout << fib(n);
}
Editor is loading...