14 lines
168 B
Ruby
14 lines
168 B
Ruby
|
#!/usr/bin/ruby
|
||
|
|
||
|
last = sum = 0
|
||
|
current = 1
|
||
|
while current < 4000000
|
||
|
if current % 2 == 0
|
||
|
sum += current
|
||
|
end
|
||
|
tmp = current
|
||
|
current += last
|
||
|
last = tmp
|
||
|
end
|
||
|
puts sum
|