Fibonacci Sum in Range
Practice
3 (1 votes)
Problem
21% Success 23 Attempts 5s Time Limit 256MB Memory 1024 KB Max Code
Write a program to print the sum of Fibonacci numbers in a given range. Assume the Fibonacci series starts as 0, 1, 1, 2, 3....
Input
An integer T, denoting the number of testcases, followed by T lines, each containing two integers L, R.
Output
Print the sum of all Fibonacci numbers between the Lth and Rth Fibonacci numbers. The Rth
Fibonacci number is excluded from the sum.
Input Constraint
1 <= T <= 100
0 <= L, R < 100
Sample Input
2 0 4 2 5
Sample Output
4 6
Code Editor
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Submissions
Please login to view your submissions
Similar Problems
Points:20
5 votes
Tags:
Easy
Points:20
4 votes
Tags:
Easy
Points:20
239 votes
Tags:
Ad-HocMathematicsOpenApprovedEasyMathamatics
Editorial
No editorial available for this problem.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor