Develop an algorithm in Python and write a code that prompts the user to input a number and returns the square root of that number.
I have written the program using PYTHON PROGRAMMING LANGUAGE.
OUTPUT:
CODE:
#imported math module
import math
#function definition for SquareRoot
def SquareRoot(InputNumber):
#returned square root of given input number
return math.sqrt(InputNumber)
if(__name__=="__main__"):
#taking user input for the number
number = float(input("Enter a number : \t"))
#to print the result on the console by calling SquareRoot function
print("\nOUTPUT : \nSquare Root of "+str(number)+" is "+str(SquareRoot(number)))
Thanks..
Get Answers For Free
Most questions answered within 1 hours.