Find the Fabbonacci series upto n-terms.
Answers
Answered by
5
Answer:
Algorithm to generate Fibonacci series upto n value
Input the n value until which the Fibonacci series has to be generated.
Initialize sum = 0, a = 0 and b = 1.
Print the first two terms of the series, a and b.
sum = a + b.
If(sum < n)
print (sum)
swap a and b and swap b and sum.
If (sum > n)
Similar questions