WAP summation of the fibonacci number between 1 to 50, but take only the number which as 1 in it .
Answers
Answered by
1
Explanation:
Given a number positive number n, find value of f0 + f1 + f2 + …. + fn where fi indicates i’th Fibonacci number. Remember that f0 = 0, f1 = 1, f2 = 1, f3 = 2, f4 = 3, f5 = 5, …
Examples :
Input : n = 3 Output : 4 Explanation : 0 + 1 + 1 + 2 = 4 Input : n = 4 Output : 7 Explanation : 0 + 1 + 1 + 2 + 3 = 7
hope it helps you
Similar questions