Sum of numbers in an interval X15128


Statement
 

pdf   zip

html

Write a funcion sum_interval(a, b) that receives two integers a,b such that ab, and returns the sum of all integers in [a,b].

Sample session
>>> sum_interval(5,10)
45
>>> sum_interval(1,100)
5050
>>> sum_interval(10,20)
165
Information
Author
ProAl
Language
English
Official solutions
Python
User solutions
Python