Go language provides inbuilt support for basic constants and mathematical functions to perform operations on the numbers with the help of the math package. You are allowed to find the square root of the specified number with the help of the Sqrt() function provided by the math package. So, you need to add a math package in your program with the help of the import keyword to access the Sqrt() function.
func Sqrt(a float64) float64
- If you pass +Inf in this function, then this function will return +Inf.
- If you pass +0 or -0 in this function, then this function will return +0 or -0.
- If the value of a < -1, then this function will return NaN.
- If you pass NaN in this function, then this function will return NaN.
Result 1: 0.0 Result 2: NaN Result 3: +Inf Result 4: NaN Result 5: 6.0
10.000 + 5.000 = 15.000