B
Brian Geds
Hey guys im trying to get this to work but I can't for reason, can you
look over it and tell me the problem, the first part will work 1-9 but
when I do the array variable to 1-1000 I cant seem to get it to do it.
Please Help heres the code
# def roman_numeral(number)
# result = ''
# if number > 5
# result = 'V' + 'I' * (number - 5)
# else
# result = 'I' * number
# end
# return result
# end
# (1..9).each() do |my_number|
# puts roman_numeral(my_number)
# end
$numerals = [
[1000, 'M'],
[500, 'D'],
[100, 'C'],
[50, 'L'],
[10, 'X'],
[5, 'V'],
[1, 'I']
]
def roman_numeral(number)
$numerals.each do |decimal, numeral|
# do something interesting with each decimal, numeral pair
end
end
(1..49).each() do |my_number|
puts roman_numeral(my_number)
end
look over it and tell me the problem, the first part will work 1-9 but
when I do the array variable to 1-1000 I cant seem to get it to do it.
Please Help heres the code
# def roman_numeral(number)
# result = ''
# if number > 5
# result = 'V' + 'I' * (number - 5)
# else
# result = 'I' * number
# end
# return result
# end
# (1..9).each() do |my_number|
# puts roman_numeral(my_number)
# end
$numerals = [
[1000, 'M'],
[500, 'D'],
[100, 'C'],
[50, 'L'],
[10, 'X'],
[5, 'V'],
[1, 'I']
]
def roman_numeral(number)
$numerals.each do |decimal, numeral|
# do something interesting with each decimal, numeral pair
end
end
(1..49).each() do |my_number|
puts roman_numeral(my_number)
end