Pages

Wednesday, July 13, 2011

Problem #2

Problem link
Solution:
package main

func main() {
a, b, sum := 1, 2, 0
for b < 4000000 {
if b%2 == 0 {
sum += b
}
a, b = b, a+b
}
println(sum)
}



Result: 4613732
Time: 0m0.003s

No comments: