Wednesday, January 27, 2021

Power of a Number in Ruby

 Design and create a program that will ask the user to give base and exponent values and then the program will compute the power value of the number and then display the result on the screen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.





Program Listing

# power.rb
# Written By Mr. Jake Rodriguez Pomperada,BSCS,MAED-IT
# Tools : Ruby 2.6.3 and Sublime Text Editor 
# May 13, 2019    Monday   9:48 PM
# Bacolod City, Negros Occidental
# Website       : http://www.jakerpomperada.com
# Email Address : jakerpomperada@gmail.com

puts "\n\n"
print "\tPower of a Number in Ruby";
puts "\n\n"
print "\tEnter a Base Number : ";
base = gets;
print "\tEnter an Exponent   : ";
exponent = gets;

base = base.to_i;
exponent = exponent.to_i;

solve_power = (base ** exponent);

print "\n\n";
print "\tDISPLAY RESULTS";
print "\n\n";
print "\t#{base} ^ #{exponent} = #{solve_power}";
puts "\n\n";
print "\tEnd of Program";
puts "\n";

No comments:

Post a Comment