16 lines
191 B
Go
16 lines
191 B
Go
|
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)
|
||
|
}
|