|
|
|
## gcd
|
|
|
|
|
|
|
|
### Instructions
|
|
|
|
|
|
|
|
Write a program that takes two `string` representing two strictly positive integers that fit in an `int`.
|
|
|
|
|
|
|
|
The program displays their greatest common divisor followed by a newline (`'\n'`).
|
|
|
|
|
|
|
|
If the number of arguments is different from 2, the program displays nothing.
|
|
|
|
|
|
|
|
All arguments tested will be positive `int` values.
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ go run . 42 10 | cat -e
|
|
|
|
2$
|
|
|
|
$ go run . 42 12
|
Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
5 years ago
|
|
|
6
|
|
|
|
$ go run . 14 77
|
Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
5 years ago
|
|
|
7
|
|
|
|
$ go run . 17 3
|
Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
5 years ago
|
|
|
1
|
|
|
|
$ go run .
|
|
|
|
$ go run . 50 12 4
|
|
|
|
$
|
|
|
|
```
|