Skip to content

Instantly share code, notes, and snippets.

@MohamedAlaa
Last active August 29, 2015 13:55
Show Gist options
  • Save MohamedAlaa/8722642 to your computer and use it in GitHub Desktop.
Save MohamedAlaa/8722642 to your computer and use it in GitHub Desktop.
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