Sum Numbers But 5

Collapse Content

Here's a basic challenge to get started. In each test case, you will be given two numbers a and b. The fiveless sum of a range of numbers is the sum of all the numbers from a to b (inclusive) except for any multiple of 5. Print out the fiveless sum of each given pair of numbers.

For example, if you're given 1 and 6 as input, print out 16.

(1+2+3+4+6 = 16)


-10,000,000 < a < b < 10,000,000

Input Format

You are provided with boilerplate code to process the input, but here's the format in case you want to do it yourself:

The first line contains t for the number of test cases. t lines follow which each contain one two integers a and b.

Output Format

Output the fiveless sum for each pair of integers on its own line.

Sample Input

1 6
-7 17

Sample Output


Note: To pass the contest part in Ruby, you'll need to optimize your code a bit...


Print out the fiveless sum of each pair of numbers.

Please sign in or sign up to submit answers.

Alternatively, you can try out Learneroo before signing up.

Contact Us