Ruby Program to Add Two Integer Numbers Article has many meanings. We are going to know this topic clearly through this article. We hope you like this article.

Ruby Program to Add Two Integer Numbers
=begin
Ruby program to add two numbers.
=end
# input the numbers and converting
# them into integer
puts "Enter first value: "
num1=gets.chomp.to_i
puts "Enter second value: "
num2=gets.chomp.to_i
# finding sum
sum=num1+num2
# printing the result
puts "The sum is #{sum}"
First run:
Enter first value:
123
Enter second value:
456
The sum is 579
Second run:
Enter first value:
-120
Enter second value:
20
The sum is -100
Final Words
Ruby Program to Add Two Integer Numbers We got to know our topic very clearly. And if you have any doubts about this article you can let us know your doubts via comment.