Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Square-but-not-cube/Go/square-but-not-cube.go
Normal file
19
Task/Square-but-not-cube/Go/square-but-not-cube.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
)
|
||||
|
||||
func main() {
|
||||
for n, count := 1, 0; count < 30; n++ {
|
||||
sq := n * n
|
||||
cr := int(math.Cbrt(float64(sq)))
|
||||
if cr*cr*cr != sq {
|
||||
count++
|
||||
fmt.Println(sq)
|
||||
} else {
|
||||
fmt.Println(sq, "is square and cube")
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue