A program that I wrote using Ruby programming language that will ask the user to give two numbers and then our program will find the difference of the two numbers. The code is very simple and easy to understand. Thank you.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Sample Program Output
Program Listing
print "\n\n";
print "Difference 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
difference = difference.to_i
difference = (val1 -val2)
print "\n\n";
puts "The difference of #{val1} and #{val2} is #{difference}.";
print "\n\n";
print "End of Program";
print "\n\n";
No comments:
Post a Comment