# Fibonacci series in python by R4R Team

- fibonacci series is a sequence of numbers in which each number is obtain by the sum of two previous numbers, starting from 0 and 1.

Fibonacci series upto n term-

0 1 1 2 3 5 8 13 21 34 ..............n

program-

def fibonacci(n):
print("0 1",end=" ")
a=0
b=1
for i in range(n-2):
s=a+b
a=b
b=s
print(s,end=" ")
print("n")
#fibonacci series upto 10 term
fibonacci(10)

#fibonacci series upto 20 term
fibonacci(20)

#fibonacci series upto 50 term
fibonacci(50)

output-

0 1 1 2 3 5 8 13 21 34

0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181

0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 5702887 9227465 14930352 24157817 39088169 63245986 102334155 165580141 267914296 433494437 701408733 1134903170 1836311903 2971215073 4807526976 7778742049

-In this program, we make a function named as 'fibonacci()' which are able to print the fibonacci series upto n terms, so we called this function with different values of n and print series.
How fibonacci() function works ?
- Firstly we print 0 1 by itself, then we add both and store in s by 's=a+b' then we store previous number and new number in a and b respectively by a=b, b=s, and then print and continue this process uptil loop run.