mirror of https://github.com/01-edu/public.git
corrected
This commit is contained in:
parent
891a4fc8ad
commit
0a78c83149
|
@ -1,12 +1,12 @@
|
||||||
## CountStars
|
## CountStars
|
||||||
|
|
||||||
### Instructions
|
### Instructions
|
||||||
Write a function called CountStars that counts the stars up to a number given as an argument.
|
|
||||||
|
Write a function called `CountStars` that counts the stars up to a number given as an argument.
|
||||||
|
|
||||||
- If the number is negative or equal to 0, return "`No stars`"
|
- If the number is negative or equal to 0, return "`No stars`"
|
||||||
- No need to manage overflow.
|
- No need to manage overflow.
|
||||||
|
|
||||||
The Library strconv is allowed.
|
|
||||||
|
|
||||||
### Expected Function
|
### Expected Function
|
||||||
|
|
||||||
```go
|
```go
|
||||||
|
@ -14,15 +14,15 @@ func CountStars(num int) string {
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
Here is a possible program to test your function :
|
Here is a possible program to test your function :
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import (
|
package main
|
||||||
"fmt"
|
|
||||||
"strconv"
|
import "fmt"
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println(CountStars(5))
|
fmt.Println(CountStars(5))
|
||||||
|
@ -33,7 +33,6 @@ func main() {
|
||||||
```
|
```
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ go run .
|
$ go run .
|
||||||
1 star...2 stars...3 stars...4 stars...5 stars
|
1 star...2 stars...3 stars...4 stars...5 stars
|
||||||
|
|
Loading…
Reference in New Issue