top of page

Fibonacci Series

Subham Das

A Fibonacci Series in which the first two numbers are 0 and 1 and the next numbers is sum of the preceding ones. It is a mathematical series, in which a number is get from the sum the two numbers present before it.


Xn = Xn-1 + Xn-2


# Program for Fibonacci series.

# Series : 0, 1, 1, 2, 3, 5, 8, 13, ..................


n = eval(input("Enter Number:"))

sum = 0

a = 0

b = 1

i = 1

while i < n :

if i == 1 :

print(0,end=" ")

elif i == 2 :

print(1,end=" ")

else :

sum = a+b

a = b

b = sum

print(sum,end=" ")

i += 1

print()



17 views0 comments

Recent Posts

See All

Mathematical Series

There so many mathematical series. One of the series is given below. And we use different programming language to print the sum or the...

Comentarios


logo12.PNG

Join my mailing list

2019 established by trueprogrammer

bottom of page