Write a program to generate n terms of the FIBONACCI series and find the sum of its even values. Example ----If n = 10, then Fibonacci series :- 0 1 1 2 3 5 8 13 21 34 Sum of Even values = 2+8+34 = 44 . Write Proper variable description
Answers
Answered by
0
Answer:
Explanation:
def fiboSeries(n):
if(n <= 1):
return -1
else:
return (fiboSeries( n - 1 ) + fiboSeries( n - 2 ))
if __name__ == "__main__" :
sum = 0
length = int(input("Enter number of terms:"))
print(" Fibonacci sequence using Recursion :")
for iter in range(length):
print(fiboSeries(iter))
if length % 2 == 0:
sum += length
print( sum )
Similar questions