Last active
September 8, 2016 10:15
-
-
Save bibikovilya/4f7d8deaa7d2a8f3efff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fib(n) | |
return 1 if n == 1 || n == 2 | |
return fib(n-1) + fib(n-2) | |
end | |
def fakt(n) | |
return 1 if n == 1 | |
return fakt(n-1)*n | |
end | |
def sum(arr, i) | |
return (i == 0) ? arr[0] : sum(arr, i--) + arr[i] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment