Sum of numbers in an interval (2) X39837


Statement
 

pdf   zip

Write a funcion @sum_interval(a, b, n)@ that receives two integers a,ba,b such that 0ab0\le{a}\le{b}, and a natural 0n90\le{n}\le{9}, and returns the sum of all integers in [a,b][a,b] whose last digit is nn.

Sample session

Sample session
>>> sum_interval(5,10,8)
8
>>> sum_interval(5,10,3)
0
>>> sum_interval(1,100,6)
510
>>> sum_interval(10,20,0)
30
Information
Author
ProAl
Language
English
Official solutions
Python
User solutions
Python