print Fibonacci series up to N terms and sum
Answers
Answered by
0
Answer:
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