Saturday, October 15, 2016

Product of Two Numbers in Ruby

A very simple program that I wrote using Ruby as my programming language that will ask the user to give two numbers and then our program will compute for the product of the two numbers.

Add me at Facebook my addressis jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.



Program Listing

print "\n\n";
print "Product of Two Numbers in Ruby"
print "\n\n";
print "enter number 1 : ";
val1 = gets;
print "enter number 2 : ";
val2 = gets;

val1 = val1.to_i
val2 = val2.to_i

product = product.to_i

product = (val1 * val2)

print "\n\n";
puts "The product of #{val1} and #{val2} is #{product}."
print "\n\n";




No comments:

Post a Comment