forked from root/public
Compare commits
8 Commits
master
...
DEV-3182-n
Author | SHA1 | Date |
---|---|---|
Tiago Collot | 8bffbbfdb2 | 2 years ago |
Tiago Collot | e16eea8ac3 | 2 years ago |
Tiago Collot | e14ee1c2ab | 2 years ago |
Tiago Collot | b8056c3de2 | 2 years ago |
zainab Dnaya | 74493965b6 | 2 years ago |
zainabdnaya | 67606b336b | 2 years ago |
zainabdnaya | 7f7b5be8f9 | 2 years ago |
zainabdnaya | e6107c4e40 | 2 years ago |
1 changed files with 49 additions and 0 deletions
@ -0,0 +1,49 @@
|
||||
## fishandchips |
||||
|
||||
### Instructions |
||||
|
||||
Write a function called `FishAndChips()` that takes an `int` and returns a `string`. |
||||
|
||||
- If the number is divisible by 2, print `fish` followed by a newline `\n`. |
||||
- If the number is divisible by 3, print `chips` followed by a newline `\n`. |
||||
- If the number is divisible by 2 and 3, print `fish and chips` followed by a newline `\n`. |
||||
- If the number is negative return `error: number is negative` followed by a newline `\n`. |
||||
- If the number is non divisible return `error: non divisible` followed by a newline `\n`. |
||||
|
||||
### Expected function |
||||
|
||||
```go |
||||
func FishAndChips(n int) string { |
||||
|
||||
} |
||||
``` |
||||
|
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
package main |
||||
|
||||
import ( |
||||
"fmt" |
||||
"piscine" |
||||
) |
||||
|
||||
func main() { |
||||
fmt.Println(piscine.FishAndChips(4)) |
||||
fmt.Println(piscine.FishAndChips(9)) |
||||
fmt.Println(piscine.FishAndChips(6)) |
||||
} |
||||
``` |
||||
|
||||
And its output: |
||||
|
||||
```console |
||||
fish$ |
||||
$ |
||||
chips$ |
||||
$ |
||||
fish and chips$ |
||||
$ |
||||
``` |
Loading…
Reference in new issue