Skip to content

Instantly share code, notes, and snippets.

Created January 5, 2014 17:02
Show Gist options
  • Save anonymous/8270782 to your computer and use it in GitHub Desktop.
Save anonymous/8270782 to your computer and use it in GitHub Desktop.
text = ''
def call_numerals num
array_num = [1000, 500, 100, 50, 10, 5, 1]
array_letter = ['M', 'D', 'C', 'L', 'X', 'V', 'I']
roman_numerals num, array_num, array_letter
end
def roman_numerals num, array_num, array_letter
letter_number = 0
array_num.each do |n|
left = num % n
text << array_letter[letter_number] * left
letter_number.+1
end
text
end
puts(call_numerals(125))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment