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