soru3

mail@pastecode.io avatar
unknown
python
2 years ago
294 B
5
Indexable
Never
def fibonacci(n):

    if n < 0:
        print("There isnt any fib")
 
    elif n == 0:
        return 0
 
    elif n == 1 or n == 2:
        return 1
 
    else:
        return fibonacci(n-1) + fibonacci(n-2)
 
value = int(input("Enter value to calculate fibonacci: "))
print(fibonacci(value))