Created
July 20, 2017 12:22
-
-
Save aoirint/429837ec58120e30092349ce22c780da to your computer and use it in GitHub Desktop.
Rubyでフィボナッチ数列のテスト
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 fibo(i) | |
if i == 1 then | |
return 0 | |
end | |
if i == 2 then | |
return 1 | |
end | |
return fibo(i-1) + fibo(i-2) | |
end | |
for i in 1..30 | |
print(fibo(i), "\n") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment