Simple program to execute sum of fibonacci series in python using while loop. In this program, we can execute the python program for beginners to understand concepts like while loop and its execution procedures.
Fibonacci Series Definition
The Fibonacci sequence is a set of numbers in which each successive number is the sum of the two preceding numbers. The series begins at 0 and 1 and continues indefinitely: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, and so on.
For Loop in Python
In Python, a for loop is a control flow statement that is used to execute a set of statements repeatedly as long as the condition is met. An iterative statement is another name for this type of statement. A for loop is thus an iterative statement.
Sum of Fibonacci Series in Python Using While Loop
no = int(input("Enter the fibonacci series"))
a = 0
b = 1
Sum = 0
for Num in range(0, no):
print(a, end = ' ')
Sum = Sum + a
Next = a + b
a = b
b = Next
print("\n Sum of the fibonacci series is %d" %Sum)
Output:
Enter the fibonacci series 3
0 1 1
Sum of the fibonacci series is 2
C Program For Palindrome String Using Recursion
Insertion Sort Program in C With Output
Insertion Sort in C Using Function
Insertion Sort Program in C Using For Loop
Python Program to Find GCD of Two Numbers Using Function
Logical Operators in C Programming With Example
C Program to Add Two Matrices Using an Array
C Program to Find Reverse of a String Using Recursion
C Program to Implement Quick Sort Using Recursion