Browse Source

add(subject): add subject betweenus

1274-oddlength
hamza 2 years ago committed by David Mata
parent
commit
270e1f370b
  1. 36
      subjects/betweenus/README.md

36
subjects/betweenus/README.md

@ -0,0 +1,36 @@
## between-us
write a function named `BetweenUs` that takes 3 paramters and checks if the first number is between the second and third number.
- If the first number is between the second and third number, return `true` else return `false`
### Function
```go
func BetweenUs(num, min, max int) bool {
// Your code here
}
```
### Usage
```go
package main
import "fmt"
func main(){
fmt.Println(BetweenUs(1, 2, 3))
fmt.Println(BetweenUs(1, 1, 3))
fmt.Println(BetweenUs(1, 3, 3))
fmt.Println(BetweenUs(1, 1, 1))
fmt.Println(BetweenUs(1, 2, 1))
}
```
```console
$ go run .
false
true
false
true
false
```
Loading…
Cancel
Save