Skip to content

Instantly share code, notes, and snippets.

@Ham-e
Created April 21, 2013 02:12
Show Gist options
  • Save Ham-e/5428184 to your computer and use it in GitHub Desktop.
Save Ham-e/5428184 to your computer and use it in GitHub Desktop.
object Euler002 extends App {
def addFib(num1:Int, num2:Int, result:Int) : Int = {
var sum = result
if(num2%2 == 0) sum += num2
var newNum = num1+num2
if(newNum > 4000000) return sum
else return addFib(num2, newNum, sum)
}
println(addFib(1,2,0))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment