daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def roman_numeral_old eng_number
  2.   roman_number = []
  3.   numerals = [[1000, "M"], [500, "D"], [100, "C"], [50, "L"], [10, "X"], [5, "V"], [1, "I"]]
  4.  
  5.   numerals.each do |div, letter|
  6.     (eng_number / div).times do
  7.       roman_number.push letter
  8.     end
  9.     eng_number = eng_number % div
  10.   end
  11.   eng_number = 1984
  12.   roman_number
  13. end
  14.  
  15. puts "Give me a number "
  16. eng_number = gets.chomp.to_i
  17. answer = roman_numeral_old eng_number
  18. puts answer.to_s
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top