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

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

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
1040 votes
Tags:
Ad-HocEasyImplementation
Points:50
Tags:
Graph TheoryHard
Points:30
15 votes
Tags:
AlgorithmsApprovedBit manipulationMediumOpen
Editorial

No editorial available for this problem.