Derek Perrault wrote:
> Modulus division = Remainder division
> 
> Two goes into five two times, with one left over.   5 / 2  = 2 (R1).
> Modulus division only returns that remainder.  5 % 2 = 1
> 
> Note that, when divided by 2, odd numbers always return 1, while even
> numbers always return 0.

okay, cool. i found the answer to the question on a forum online ...

ANSWER:

def old_roman_number input

  while input < 1 || input > 3999
    puts 'Please enter a number between 1 and 3999'
    input = gets.chomp.to_i
  end

  m_mod = input%1000
  d_mod = input%500
  c_mod = input%100
  l_mod = input%50
  x_mod = input%10
  v_mod = input%5

  m_div = input/1000
  d_div = m_mod/500
  c_div = d_mod/100
  l_div = c_mod/50
  x_div = l_mod/10
  v_div = x_mod/5
  i_div = v_mod/1

  m = 'M' * m_div
  d = 'D' * d_div
  c = 'C' * c_div
  l = 'L' * l_div
  x = 'X' * x_div
  v = 'V' * v_div
  i = 'I' * i_div

  puts m + d + c + l + x + v + i

end

number = gets.chomp.to_i
old_roman_number(number)


I understnad the first few lines .. the "while" stuff and and ending 
stuff too. do you think you explain to me why the % and / works here? i 
guess i really need to get better at math. i'm sorry if i'm being really 
stupid here, hah. i just want to really understand things, not just see 
and move on .. thank you again..

-- 
Posted via http://www.ruby-forum.com/.