Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

fibonacci series

#program to find the fibonacci series
n=int(input('Enter the number of terms in the Fibonacci series :'))
f,s=0,1
print('Fibonacci series =',f,s,sep=',',end=',')
for i in range(3,n+1):
 nxt=f+s
 print(nxt,end=',')
 f,s=s,nxt
#output
Enter the number of terms in the Fibonacci series :7
Fibonacci series =,0,1,1,2,3,5,8,
________________________________________________________________________________
Enter the number of terms in the Fibonacci series :10
Fibonacci series =,0,1,1,2,3,5,8,13,21,34,
________________________________________________________________________________
Enter the number of terms in the Fibonacci series :4
Fibonacci series =,0,1,1,2,
Source by www.edureka.co #
 
PREVIOUS NEXT
Tagged: #fibonacci #series
ADD COMMENT
Topic
Name
3+3 =