Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Square Root in Go

package main 
  
import ( 
    "fmt"
    "math"
) 
  
func main() { 
     res1 := math.Sqrt(36)
     res2 := math.Sqrt(100)
     res3 := math.Sqrt(20)
     
     fmt.Printf("Result 1: %.1f", res1) 
     fmt.Printf("\nResult 2: %.1f", res2) 
     fmt.Printf("\nResult 3: %.1f", res3)
}


Output:-
Result 1: 6
Result 2: 10
Result 3: 4.5

Explanation:-
Go language provides inbuilt support for basic constants and mathematical
functions to perform operations on the numbers with the help of the math package.
To find the square root of the specified number with the help of the Sqrt() function
provided by the math package.