Skip to content

Instantly share code, notes, and snippets.

@MohamedAlaa MohamedAlaa/problem_2.rb
Last active Aug 29, 2015

Embed
What would you like to do?
Egyptian Geeks - Project Euler Problem 2
#! /usr/bin/env ruby
first = 0
second = 1
i = 0
sum = 0
limit = 4000000
while i <= limit
i = first + second
sum += i if i % 2 == 0
first = second
second = i
end
puts sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.