mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
542 B
542 B
CountStars
Instructions
Write a function named CountStar
that makes u fall asleep by counting stars, it takes an integer in the parameter
- If the number is negative or equal to 0, return "
No star
" - No need to manage overflow.
func CountStar(num int) string {
}
import (
"fmt"
"strconv"
)
func main() {
fmt.Println(CountStar(5))
fmt.Println(CountStar(4))
fmt.Println(CountStar(-1))
}
$ go run . | cat -e
1 star...2 star...3 star...4 star...5$
1 star...2 star...3 star...4$
No star$