challenges/e2/e2.2.rb

14 lines
168 B
Ruby
Executable File

#!/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