Reading from STDIN

suggest change
# Get two numbers from STDIN, separated by a newline, and output the result
number1 = gets
number2 = gets
puts number1.to_i + number2.to_i
## run with: $ ruby a_plus_b.rb
## or:       $ echo -e "1\n2" | ruby a_plus_b.rb

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents