Showing posts with label Square and Cube of a Number Solver Using Methods in Ruby. Show all posts
Showing posts with label Square and Cube of a Number Solver Using Methods in Ruby. Show all posts

Wednesday, July 10, 2019

Square and Cube of a Number Solver Using Methods in Ruby


Write a program to ask the user to give an integer number and then the program will compute the square and cube numerical values of the given number and display the result on the result.

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 in 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 I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Sample Program Output


Program Listing

 square_cure.rb


# square_cure.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : June 17, 2019   Monday 11:00 AM
# Address  : Bacolod City, Negros Occidental
# Tools    : Eclipse IDE and Ruby Version 2.6.3
# Location : Bacolod City, Negros Occidental  
# Website  : http://www.jakerpomperada.com
# Emails   : jakerpomperada@gmai.com and jakerpomperada@yahoo.com

def square(a)
  return a * a;
end

def cube(b)
  return b * b * b;
end

puts "\n\n"
print "\tSquare and Cube of a Number Solver Using Methods";
puts "\n\n"
print "\tGive First Value  : ";
val1 = gets;

val1 = val1.to_i;
square_value = square_value.to_i;
cube_value =  cube_value.to_i;


square_value = square(val1);
cube_value = cube(val1);

print "\n\n";
print("\tThe square value of #{val1} is #{square_value}.\n\n")
print("\tThe cube value of #{val1} is #{cube_value}.\n")
puts "\n\n"
print "\tEnd of Program";
puts "\n"