Thursday, March 17, 2016

Square and Cube Root Solver in Python

A simple program that I wrote using Python as my programming language that will ask the user to give a number and then the program will compute for the square and cube root value of the give number by the user.

If you have some questions please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Sample Program Output



Program Listing


print("");
print("Square and Cube Root Solver");
print("");
val1 = input("Enter a number  : ")
a = int(val1)

def square(a):   
    return int(a) * int(a)

def cube_root(a):
    return int(a) * int(a) * int(a)

print("");

square_result = square(a)
cube_result = cube_root(a)

print("The square value of ", a, " is " ,square_result,'.')
print("The cube root value of ", a, " is " ,cube_result,'.')
print("");
print("End of Program")
print("");


1 comment: