Skip to content

Instantly share code, notes, and snippets.

@aoirint
Created July 20, 2017 12:22
Show Gist options
  • Save aoirint/429837ec58120e30092349ce22c780da to your computer and use it in GitHub Desktop.
Save aoirint/429837ec58120e30092349ce22c780da to your computer and use it in GitHub Desktop.
Rubyでフィボナッチ数列のテスト
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