Created
June 3, 2012 13:46
-
-
Save yuryofujita/2863546 to your computer and use it in GitHub Desktop.
English Numerals みなとRuby会議01
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input = ARGV[0].to_i | |
underTwenty = %w(zero one two tree four five six seven eight nighn ten eleven tweleve thirteen fourteen fifteen sixteen seventeen eighteen nineteen) | |
overTwenty = %w(twenty thirty forty fifty sixty seventy eighty ninty) | |
hundred = "hundred" | |
thousand = "thousand" | |
if input <= 19 then | |
puts underTwenty[input] | |
end | |
input01 = input.to_s[1] | |
puts input | |
puts input.to_s[1] | |
puts input01 | |
if input >= 20 and input <=29 then | |
#20 | |
puts overTwenty[0] + underTwenty[input01.to_i] | |
elsif input >=30 and input <=39 then | |
#30 | |
puts overTwenty[1] | |
elsif input >=40 and input <=49 then | |
#40 | |
puts overTwenty[2] | |
elsif input >=50 and input <=59 then | |
#50 | |
puts overTwenty[3] | |
elsif input >=60 and input <=69 then | |
#60 | |
puts overTwenty[4] | |
elsif input >=70 and input <=79 then | |
#70 | |
puts overTwenty[5] | |
elsif input >=80 and input <=89 then | |
#80 | |
puts overTwenty[6] | |
elsif input >=90 and input <=99 then | |
#90 | |
puts overTwenty[7] | |
end | |
overTwenty[input-10] | |
if input <= 30 then | |
overTwenty[input-10] | |
end | |
=begin | |
teen = "teen" | |
if(input==14)..(input==19) then | |
p h.fetch(input) + teen | |
end | |
p h.fetch(input) | |
=end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
タイムアウトでかなり中途半端だけど。
気が向いたら続きやります。