forked from root/public
Compare commits
23 Commits
master
...
DEV-3177-n
Author | SHA1 | Date |
---|---|---|
Tiago Collot | 19750b34c3 | 2 years ago |
Tiago Collot | 625e79e4bc | 2 years ago |
Tiago Collot | b96911055d | 2 years ago |
Tiago Collot | 05804a6b83 | 2 years ago |
Tiago Collot | 575dcd5bb1 | 2 years ago |
Tiago Collot | fe0f3e0a3d | 2 years ago |
Tiago Collot | aefa763666 | 2 years ago |
Hamza elkhatri | 101e3bb997 | 2 years ago |
Hamza elkhatri | 0d67f5f0fe | 2 years ago |
Hamza elkhatri | f45afb15d8 | 2 years ago |
Hamza elkhatri | 2e840e3a44 | 2 years ago |
hamza | 42e2315df5 | 2 years ago |
zainabdnaya | 70959e309a | 2 years ago |
zainabdnaya | f1efcb7526 | 2 years ago |
zainabdnaya | 88ebe95b00 | 2 years ago |
zainabdnaya | dfaaffa517 | 2 years ago |
zainabdnaya | 809fd9583b | 2 years ago |
zainabdnaya | ec53e392ea | 2 years ago |
zainabdnaya | 2e9bf77496 | 2 years ago |
zainabdnaya | 6a3fb03ab7 | 2 years ago |
zainabdnaya | b3ce798b34 | 2 years ago |
zainabdnaya | c9a6392c07 | 2 years ago |
zainabdnaya | 81ee9008f9 | 2 years ago |
1 changed files with 47 additions and 0 deletions
@ -0,0 +1,47 @@
|
||||
## fromto |
||||
|
||||
### Instructions |
||||
|
||||
Write a function that takes two `integers` and returns a `string` showing the range of numbers from the first to the second. |
||||
|
||||
- The numbers must be separated by a comma and a space. |
||||
- If any of the arguments is bigger than 99 or less than 0, the function returns `Invalid` followed by a newline `\n`. |
||||
- Add a `0` at the beginning of any number if it is less than 10. |
||||
- Add a new line `\n` at the end of the `string`. |
||||
|
||||
### Expected function |
||||
|
||||
```go |
||||
func FromTo(from int, to int) string { |
||||
|
||||
} |
||||
``` |
||||
|
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
package main |
||||
|
||||
import ( |
||||
"fmt" |
||||
"piscine" |
||||
) |
||||
|
||||
func main() { |
||||
fmt.Print(piscine.FromTo(1, 10)) |
||||
fmt.Print(piscine.FromTo(10, 1)) |
||||
fmt.Print(piscine.FromTo(10, 10)) |
||||
fmt.Print(piscine.FromTo(100, 10)) |
||||
} |
||||
``` |
||||
And its output: |
||||
|
||||
```console |
||||
$ go run . | cat -e |
||||
01, 02, 03, 04, 05, 06, 07, 08, 09, 10$ |
||||
10, 09, 08, 07, 06, 05, 04, 03, 02, 01$ |
||||
10$ |
||||
Invalid$ |
||||
``` |
Loading…
Reference in new issue