Fibonacci Series h
π€cs
π
Last updated 14 days ago
The Fibonacci series is one of the most fascinating patterns in mathematics β and it shows up everywhere, from flower petals to galaxy spirals. Itβs named after Leonardo Fibonacci, an Italian mathematician who introduced this sequence to Western mathematics in the 13th century.
π»Source Code
# Program to generate Fibonacci series up to n terms
def fibonacci(n):
# The first two terms are fixed
a, b = 0, 1
series = []
# Generate n terms
for _ in range(n):
series.append(a)
a, b = b, a + b # Move forward in the series
return series
# Example usage
n = int(input("Enter the number of terms: "))
print("Fibonacci Series:", fibonacci(n))πRelated Snippets
Similar code snippets you might find interesting
π¬Comments (10)
πPlease login to post comments
T
testβ°posted 13 days ago
iou
T
testβ°posted 13 days ago
iou
T
testβ°posted 12 days ago
new comment added
T
testβ°posted 12 days ago
aaaaa
T
testβ°posted 12 days ago
aa dd ddd
T
testβ°posted 12 days ago
Newly Comments Added
T
testβ°posted 12 days ago
dddd
T
testβ°posted 12 days ago
zzzzz
T
testβ°posted 12 days ago
sssss
T
testβ°posted 12 days ago
ddddd
β‘Actions
Share this snippet:
π€About the Author
c
cs
Active contributor
