challenges/e2/e2.go

16 lines
191 B
Go
Raw Normal View History

2014-08-21 06:10:58 +00:00
package main
import (
"fmt"
)
func main() {
sum := 0
for prev, curr := 1, 1; curr <= 4000000; prev, curr = curr, prev+curr {
if curr%2 == 0 {
sum += curr
}
}
fmt.Println(sum)
}