(adsbygoogle = window.adsbygoogle || []).push({ google_ad_client: "ca-pub-2960223314593660", enable_page_level_ads: true }); Program to print n number of fibonacci series - TecGlance

Header Ads

Program to print n number of fibonacci series


Program to print n number of fibonacci series

num=input("Enter how many terms of fibonacci series to be printed: ")
a, b = 0, 1
print a
for i in range(1,num+1):
     print b
     a, b = b, a+b

 

OUTPUT :

  
Enter the range upto which the fibonacci series is to be printed :  10
0
1
1
2
3
5
8
13
21
34
55
  
Enter the range upto which the fibonacci series is to be printed :  11
0
1
1
2
3
5
8
13
21
34
55
89

No comments

Powered by Blogger.