sum: range
This commit is contained in:
parent
5775ea5e50
commit
b427b8fbfb
@ -3,8 +3,8 @@ package sum
|
|||||||
func Sum(numbers [5]int) int {
|
func Sum(numbers [5]int) int {
|
||||||
sum := 0
|
sum := 0
|
||||||
|
|
||||||
for i := 0; i < 5; i++ {
|
for _, number := range numbers {
|
||||||
sum += numbers[i]
|
sum += number
|
||||||
}
|
}
|
||||||
return sum
|
return sum
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user