fibonacci sums ruby
# Write a method that finds the sum of the first n fibonacci numbers recursively.
# Assume n > 0.
def fibs_sum(n)
return 1 if n == 1
return 2 if n == 2
n + fibs_sum(n-1)
end
fibonacci sums ruby
# Write a method that finds the sum of the first n fibonacci numbers recursively.
# Assume n > 0.
def fibs_sum(n)
return 1 if n == 1
return 2 if n == 2
n + fibs_sum(n-1)
end
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us