Python Program to Find Fibbonaci series using For Loop
This examples shows, how to find fibonacci series. Fibonacci series is a sequence of numbers where each number is the sum of the previous two consecutive numbers. The series begins with 0 and 1.
Steps
- Get the input number from user.
- Fibonacci series sequence of numbers in which each number is the sum of the two preceding ones.
- Fibonacci series starting with 0 and 1.
Example :
Example.py
val = int(input("Enter a number: ")) a = 0 b = 1 print("Fibonacci Series:", a, b, end=" ") for i in range(2, val): c = a + b a = b b = c print(c, end=" ")
Output
Enter a number: 8 Fibonacci Series: 0 1 1 2 3 5 8 13