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