-2

ここで何が問題なのですか?何も思いつきません?

print "Type the first digit, hit enter."
first_digit = gets.chomp

print "Now type the second digit you wish to add."
second_digit = gets.chomp

answer = second_digit + first digit

print "Here is your answer:#{answer}"


sleep 5
4

1 に答える 1

2

You might want to convert those strings into integers:

first_digit = gets.chomp.to_i

Also, you forgot an underscore here:

answer = second_digit + first digit
                             ^ right here
于 2013-02-05T00:53:57.963 に答える