aboutsummaryrefslogtreecommitdiff
path: root/week10/ex2.cpp
blob: 3d3e9a1f6921a885d9f0a06e8d959c74158bdeb8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>

int fibIndex(const int N, int count = 0, int a = 0, int b = 1) {
	if (N == a) return count;
	return fibIndex(N, count + 1, b, a+b);
}

int main() {
	int N;
	std::cin >> N;
	std::cout << fibIndex(N) << std::endl;
}