- 1
Write a program to print Fibonacci series using recursion ?
4 Respuestas
0
https://code.sololearn.com/cBbhZmNWUTCM/?ref=app
0
num = int(input()) #Entrada del usuario
def fibonacci(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fibonacci(n-1) + fibonacci(n-2)
for i in range(num):
print(fibonacci(i)) #Llamada de la funcion
- 1
don't know if it's this what you're looking for:
don't has to be the first 20 numbers. you can use a variable for the number of terms.
https://code.sololearn.com/cXbdq0cz1Z65/?ref=app