Sum And Divide
Lesson 2 of 24 in Coddy's Golang Challenges - Level 1 course.
Challenge
EasyWrite a function that will take two numbers, calculate the sum of all numbers between them (inclusive), and divide that sum by the sum of the two entered numbers.
Example:
For the numbers 4 and 10:
Calculate the sum of all numbers between 4 and 10:
4 + 5 + 6 + 7 + 8 + 9 + 10 = 49
Divide this sum by the sum of the two entered numbers:
49 / 4 + 10
The result will be:
3.5
Try it yourself
func sumAndDivide() () {
}All lessons in Golang Challenges - Level 1
1Introduction
Introduction2Play With Numbers
Sum And DivideGenerate PatternNumber RotationEven and Divisible NumbersDiamond PatternAbundant NumberCheck a Number