❮ Previous Next ❯

Python Program to Print the Fibonacci series


FibonacciExample1.py

nterm=int(input("Enter the no.of terms"))

#first two terms

n1=0

n2=1

count=0

#check if the nterm is valid or not

if nterm<=0:

   print("Please enter a positive integer value")

elif nterm==1:

   print(n1)

else:

   print("Fibonacci Series is:")

   while(count<nterm):

   print(n1,end=' ')

   n3=n1+n2

   n1=n2

   n2=n3

   count+=1


python Fibonacci series
❮ Previous Next ❯

Follow Us




  Tutorials

Popular Links

Contact Us

address Plot No-741,2ND Floor
Opp. Bhagabati Temple,Jayadev Vihar
      Bhubaneswar-751013
      Email: info@silantechnology.com
      Phone: 0674-2361252
address
39877, sundale dr, apt#101, Fremont, California 94538, USA
       Phone: +1(262)388-7619

facebook twitter google linked in

© 2018 Silan Technology. All Rights Reserved