Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Fibonacci Sequence

nterms = int(input())

x, y, z = 1, 1, 0

if nterms == 1:
   print(x)
else:
   while z < nterms:
       print(x, end=" ")
       nth = x + y
       x = y
       y = nth
       z += 1
Source by www.homeworklib.com #
 
PREVIOUS NEXT
Tagged: #Fibonacci #Sequence
ADD COMMENT
Topic
Name
1+9 =