A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Fibonacci in Ruby page! Here, you'll find the source code for this program as well as a description of how the program works.
def fibonacci(number)
a = 0
b = 1
c = 0
i = 0
while i < number
c = a + b
b = a
a = c
print("#{i+1}: #{c}\n")
i += 1
end
end
num = Integer(ARGV[0]) rescue -1
if num >= 0
fibonacci(num)
else
print("Usage: please input the count of fibonacci numbers to output")
end
Fibonacci in Ruby was written by:
If you see anything you'd like to change or update, please consider contributing.
Note: The solution shown above is the current solution in the Sample Programs repository as of Apr 07 2019 00:40:32. The solution was first committed on Oct 14 2018 13:08:19. As a result, documentation below may be outdated.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.