forked from root/public
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.
43 lines
693 B
43 lines
693 B
![]()
2 years ago
|
## common-multiples
|
||
|
|
||
|
### Instructions
|
||
|
|
||
|
Write a function to check whether a given non-negative number is a multiple of 3 or 7.
|
||
|
- If the number is a multiple of 3 or 7, return `true`.
|
||
|
- If the number is not a multiple of 3 or 7, return `false`.
|
||
|
- If the number is less or equal to 0, return `false`.
|
||
|
|
||
|
### Expected function
|
||
|
|
||
|
```go
|
||
|
func IsMultiple(number int) bool {
|
||
|
// Your code here
|
||
|
}
|
||
|
```
|
||
|
|
||
|
### Usage
|
||
![]()
2 years ago
|
|
||
![]()
2 years ago
|
```go
|
||
|
package main
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
func main() {
|
||
|
fmt.Println(IsMultiple(3))
|
||
|
fmt.Println(IsMultiple(7))
|
||
|
fmt.Println(IsMultiple(8))
|
||
|
fmt.Println(IsMultiple(9))
|
||
|
fmt.Println(IsMultiple(-1))
|
||
|
}
|
||
|
```
|
||
|
|
||
|
and the output should be:
|
||
|
|
||
|
```console
|
||
|
$ go run .
|
||
|
true
|
||
|
true
|
||
|
false
|
||
![]()
2 years ago
|
true
|
||
![]()
2 years ago
|
false
|
||
|
```
|