Last active
March 9, 2016 21:21
-
-
Save brydavis/117a28db6053d53ad791 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
import "math" | |
var pow = math.Pow | |
var sqrt = math.Sqrt | |
func main() { | |
x1, y1 := 0, 0 | |
x2, y2 := 4, 5 | |
a := float64(x2 - x1) | |
b := float64(y2 - y1) | |
c2 := pow(a, 2.0) + pow(b, 2.0) | |
fmt.Println(sqrt(c2)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
import . "math" | |
func main() { | |
x1, y1 := 0, 0 | |
x2, y2 := 4, 5 | |
a := float64(x2 - x1) | |
b := float64(y2 - y1) | |
c2 := Pow(a, 2.0) + Pow(b, 2.0) | |
fmt.Println(Sqrt(c2)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment