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

Header Ads

Program to print fibonacci series


Program to print fibonacci series
 

num=input("Enter the range upto which the fibonacci series is to be printed : ")
a, b = 0, 1
print a
while b < num:
     print b
     a, b = b, a+b

OUTPUT :

Enter the range upto which the fibonacci series is to be printed :  100
0
1
1
2
3
5
8
13
21
34
55
89
  
Enter the range upto which the fibonacci series is to be printed :  300
0
1
1
2
3
5
8
13
21
34
55
89
144
233
  
Enter the range upto which the fibonacci series is to be printed :  1000
0
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987

No comments

Powered by Blogger.