How do I sum thses two variables?
puts "first number please"
first = gets.chomp
puts "Second number please"
second = gets.chomp
answer = first + second
puts "The calculation is #{first} + #{second} = " + answer.to_s
I summed two variables first and second if first ==1 and second ==2 then
answer should be 3 but ruby shows 12 What is problem. What I tried is
answer = first.+(second)
No comments:
Post a Comment