How to write an algorithm to find the fibonacci series ???

Help:/

The fibonacci series is defined as the set of terms a(n)∈Z+ (i.e. all terms are integers) such that:

a(0)=0
a(1)=1
a(i)=a(i-2)+a(i-1), i≥2

The pseudocode resembles a lot the definition of the series:

Input: n
a(0)=0
a(1)=1
for i=2,i<=n,i++: a(i)=a(i-2)+a(i-1) next
return a(n)

Note that a closed form formula for evaluating a(n) exists, and is called the Binet's formula:
a(n)=((p^n-(-1/p)^n)/sqrt(5)
where p=(1+sqrt(5))/2 = the golden ratio

However, since the result has to be an integer, and the calculations required are real, there could be rounding problems with calculations performed on a digital computer, unless symbolic algebra is available.

To write an algorithm for generating the Fibonacci series, you can use an iterative approach. Here's a step-by-step explanation of the algorithm:

1. Initialize three variables, "first" and "second" to 0 and 1 respectively, and "next" to 0.

2. Print the value of "first" (which is 0) as the first number in the Fibonacci series.

3. Start a loop, where the condition is that the value of "next" should be less than or equal to the desired number of terms in the series.

4. Inside the loop, assign the value of "second" to "first" and assign the sum of "first" and "second" to "next".

5. Print the value of "next".

6. Assign the value of "second" to "first" and continue the loop until the desired number of terms is reached.

Now, let's write the algorithm in pseudocode:

```
initialize first = 0, second = 1, next = 0
print first
loop until desired number of terms:
set first = second
set second = next
set next = first + second
print next
```

By implementing this algorithm in any programming language, you will be able to generate the Fibonacci series using an iterative approach.