Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

fibonacci series using recursion

def fib (n):
  if n == 0 or n ==1:
      return n  
  else:
        return fib(n-2) + fib(n-1)
#n = int(input("please enter a number  "))

n=10
for index,num in enumerate(range(n+1)):
     print(f"F{index} :", fib(num))
Source by onecompiler.com #
 
PREVIOUS NEXT
Tagged: #fibonacci #series #recursion
ADD COMMENT
Topic
Name
7+2 =