Fibonacci Series in Python
Fibonacci Sequence. The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...
Program:
first = 0; second = 1; next=0
count=int(input("Enter the number of terms:"));
print("First", count, "terms of Fibonacci series:");
for i in range(0,count,1):
if ( i <= 1 ):
next = i;
else:
next = first + second;
first = second;
second = next;
print(next);
OutPut:
No comments:
Post a Comment