Last active
July 28, 2019 19:48
-
-
Save victoriadrake/e158d143b5fbbc0b7139519c1cae4b4a to your computer and use it in GitHub Desktop.
Figure out if a pie is big enough.
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" | |
"math" | |
) | |
// Slice a `x` inch diameter pie into `n` pieces. | |
// Return true if each slice is greater than `m` inches wide. | |
func slicePie(x, n, m int) bool { | |
var radius, circumference float32 | |
radius = float32(x)/2 | |
circumference = 2 * math.Pi * radius | |
sliceSize := circumference/float32(n) | |
fmt.Println(float32(sliceSize)) | |
return sliceSize > float32(m) | |
} | |
func main() { | |
fmt.Println(slicePie(10,12,2)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment