Skip to content

Instantly share code, notes, and snippets.

@ankitkumar5422
Created March 27, 2023 10:46
Show Gist options
  • Save ankitkumar5422/ab7395986ebac610ed4ac56185291c49 to your computer and use it in GitHub Desktop.
Save ankitkumar5422/ab7395986ebac610ed4ac56185291c49 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
func Sqrt(x float64) float64 {
z:=1.0
for n:= 1;n <= 10;n++ {
z = z - ((z*z - x) / (2*z))
}
return z
}
func main() {
fmt.Println(Sqrt(2))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment