A Python program to print Fibonacci series upto n number with the help of recursion.

def recursive_fibonacci(n):
    if n <= 1:
        return n
    else:
        return (recursive_fibonacci(n-1)+recursive_fibonacci(n-2))

num = int(input('Enter a number to generate fibonacci series.'))

if(num <= 0):
    print('Please enter a value greater than 0')
else:
    print('Fibonacci Series')
    
    for i in range(num):
        print(recursive_fibonacci(i))


#Output
Enter a number to generate fibonacci series.10
Fibonacci Series
0
1
1
2
3
5
8
13
21
34

Related Examples

1. A Python program to calculate factorial of a number with the help of recursion.

Leave a Reply

Your email address will not be published. Required fields are marked *

Wordpress Social Share Plugin powered by Ultimatelysocial
Wordpress Social Share Plugin powered by Ultimatelysocial