4. Python Program to find Square root of a given number.
How does this program work?
- In this program you will learn about how to do Square root of a given number using Python.
- The following code uses sqrt() mathematical function.
- And then by using the given logic you will get output. If number is negative, the sqrt function will return a domain error.
Here is the code
import math
a = int (input("Enter an integer:"))
#To find square root of a number using sqrt() function
b = math.sqrt(a)
print("Square root of ", a," is : " ,b)