FIBONACCI SERIES :
Here is the python code for the Fibonacci series :
# Defining Functions
def fib(n): # write Fibonacci series up to n
"""Print a Fibonacci series up to n."""
a, b = 0, 1
while b < n:
print b,
a, b = b, a+b
# Now call the function we just defined:
fib(7)
Output :
1
1
2
3
5
8
13
To know about the Fibonacci Series in detail and also to know the codes of the Fibonacci Series in various other programming languages Click Here
If the above link doesn't work go to this URL :
http://gappcode.blogspot.in/2013/11/fibonacci-series.html
No comments:
Post a Comment