Browse Source

subject(Count-Negative):add readme

DEV-3047-DEV-3048-zappy-project
hamza 2 years ago committed by David Mata
parent
commit
1d8cacc5c6
  1. 38
      subjects/countnegative/README.md

38
subjects/countnegative/README.md

@ -0,0 +1,38 @@
## count-negative
### Instructions
Write a function that takes an array of integers and returns the number of negative numbers in the array.
- If the array is empty, the function should return `0`.
### Expected function
```go
func CountNegative(numbers []int) int {
// your code here
}
```
### Usage
```go
package main
import "fmt"
func main(){
fmt.Println(CountNegative([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}))
fmt.Println(CountNegative([]int{-1, -2, -3, -4, -5, -6, -7, -8, -9, -10}))
fmt.Println(CountNegative([]int{}))
fmt.Println(CountNegative([]int{-1,2,0,-3}))
}
```
and the output should be:
```console
$ go run .
0
10
0
2
```
Loading…
Cancel
Save