Python program to find square root of a number; Through this tutorial, i am going to show you how to find the square root of number in python program.
Formula for finding the square root of number; as shown below:
x2 = y x = ±√y
Python Program to Find the Square Root of Number
- Program to find square root of a number in python without using sqrt
- Python program to find square of a number using sqrt() function
Program to find square root of a number in python without using sqrt
- Get input the number from user in program.
- Find square root with this formula sqrt = num ** 0.5 in program.
- Print the square root of number.
# Python program to find square root of the number # take inputs num = float(input('Enter the number: ')) # calculate square root sqrt = num ** 0.5 # display result print('Square root of %0.2f is %0.2f '%(num, sqrt))
After executing the python program, the output will be:
PEnter the number: 4 Square root of 4.00 is 2.00
Python program to find square of a number using sqrt() function
- Import math module in program
- Get input any number from user in python program.
- Find square root of number using sqrt() function
- Print square root
# Python program to find square root of the number import math # math module # take inputs num = float(input('Enter the number: ')) # display result print('Square root = ',math.sqrt(num))
After executing the python program, the output will be:
Enter the number: 16 Square root = 4.0
Recommended Python Tutorials
Recommended:-Python Program to Print Alphabets from A to Z
Recommended:-Python Program to Find Roots of Quadratic Equation
Recommended:-Python Program to Find the Variance
Recommended:-How to Check Python Program Execution Time
Recommended:-Python Program Find Day of Week For Given Date
Recommended:-Python Program to Print Sum of All Array Elements
Recommended:-Python Program to Find the GCD of Two Numbers
Recommended:-Python Program to Find the LCM of the Array Elements
Recommended:-Python Code to Draw a Pie Chart
Recommended:-Python Program to Display the Current Date and Time
Recommended:-Python Program to Find Area of Triangle
Recommended:-Python Program to Find the Area of Rectangle