From f7ff4991982dfbc21328564b49d3ab06bb5aaa69 Mon Sep 17 00:00:00 2001 From: zainabdnaya Date: Tue, 14 Jun 2022 15:08:10 +0100 Subject: [PATCH] CountStars subject --- subjects/countstars/README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 subjects/countstars/README.md diff --git a/subjects/countstars/README.md b/subjects/countstars/README.md new file mode 100644 index 00000000..44711379 --- /dev/null +++ b/subjects/countstars/README.md @@ -0,0 +1,31 @@ +## 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. + +```go +func CountStar(num int) string { + +} +``` +```go +import ( + "fmt" + "strconv" +) + +func main() { + fmt.Println(CountStar(5)) + fmt.Println(CountStar(4)) + fmt.Println(CountStar(-1)) +} +``` + +```console +$ go run . | cat -e +1 star...2 star...3 star...4 star...5$ +1 star...2 star...3 star...4$ +No star$ +```