In Python write a program to print all the Fibonacci numbers below 10000 which are even?

We have to create Fibonacci sequence ,which have even numbers only,which are executed in python scripting.

When I was saw this problem, I immediately knew that I would need to create three algorithms:
1. List all Fibonacci terms less than one lakh.
2. Identify which of these terms are even.
3. Find the sum of these even Fibonacci terms.

But first we have to know about Fibonacci series:-

" Fibonacci number are those numbers which are the 

series, called the Fibonacci series, and after that 

every number after the first two is the sum of the two 

preceding numbers. "

The first two terms are 0 and 1 .all other terms are obtained by adding the preceding two terms.this means to say the nth term is the sum of (n-1)th and (n-2)th term.
Each new term in the Fibonacci sequence is generated by adding the previous two terms.
So, for example, starting with 1 and 2, the first 10 numbers in the sequence would be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89
Here we are using recursion in python.a recursive function recur_fibo() is used to calculate the nth term of the sequesnce.we could use for ir while loop to iterate and calculate each term recursively.
Now the solution of your program is here:-

while n1<=100000:
                if n1%2==0:
print(“even numbers:- “, count)


Post a Comment