Permalink
Browse files

this is a comment that conforms to regs

  • Loading branch information...
1 parent 8ce2e06 commit a7fddce130b8cf078b89a28a53a311f3c2594af1 @exetersalthi exetersalthi committed May 3, 2012
Showing with 24 additions and 0 deletions.
  1. +24 −0 Fibonator.rb
View
@@ -0,0 +1,24 @@
+puts "The Ultimate Fibonator"
+
+# By considering the terms in the Fibonacci sequence whose values do not exceed four million,
+# find the sum of the even-valued terms.
+
+def GetMeMyNumber(first, second)
+ first + second
+end
+
+sum = 0
+first = 0
+second = 1
+i = GetMeMyNumber(first, second)
+while i <= 4000000 do
+ puts i
+ if i % 2 == 0
+ sum += i
+ end
+ first = second
+ second = i
+ i = GetMeMyNumber(first, second)
+end
+
+puts "TOTAL " + sum.to_s

6 comments on commit a7fddce

Contributor

asiansteev replied May 7, 2012

ooh, what is this?

Collaborator

exetersalthi replied May 7, 2012

Contributor

asiansteev replied May 7, 2012

oh cool! who is this?

Owner

ashleybot replied May 7, 2012

That's Joshua.

Contributor

asiansteev replied May 7, 2012

i just sent you a pull request (i realize that this was just a teaching exercise, i just really wanted to make a "well, actually..." pull request.

Owner

ashleybot replied May 7, 2012

Beer me.

Please sign in to comment.