algo_081
Problem Statement
Problem Statement
Write an algorithm to find the N-th Fibonacci number using recursion.
Algorithm
procedure Fibonacci(N)
begin
if N < 0 then
print("Invalid input")
return(-1)
endif
if N = 0 then
return(0)
endif
if N = 1 then
return(1)
endif
return(Fibonacci(N - 1) + Fibonacci(N - 2))
end procedure1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17