mirror of https://github.com/01-edu/public.git
cba96cfa4a | ||
---|---|---|
.. | ||
README.md |
README.md
collatzcountdown
Instructions
Write a function, CollatzCountdown
, that returns the number of steps necessary to reach 1 using the collatz countdown.
- It must return
-1
ifstart
is equal to0
or negative.
Expected function
func CollatzCountdown(start int) int {
}
Usage
Here is a possible program to test your function :
package main
import (
"fmt"
"piscine"
)
func main() {
steps := piscine.CollatzCountdown(12)
fmt.Println(steps)
}
And its output :
$ go run .
9
$