mirror of https://github.com/01-edu/public.git
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.
29 lines
717 B
29 lines
717 B
6 years ago
|
## gcd
|
||
|
|
||
|
### Instructions
|
||
6 years ago
|
|
||
5 years ago
|
Write a program that takes two `string` representing two strictly positive integers that fit in an `int`.
|
||
6 years ago
|
|
||
5 years ago
|
The program displays their greatest common divisor followed by a newline (`'\n'`).
|
||
6 years ago
|
|
||
5 years ago
|
If the number of arguments is different from 2, the program displays nothing.
|
||
6 years ago
|
|
||
5 years ago
|
All arguments tested will be positive `int` values.
|
||
6 years ago
|
|
||
5 years ago
|
### Usage
|
||
6 years ago
|
|
||
|
```console
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/gcd$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/gcd$ ./gcd 42 10 | cat -e
|
||
6 years ago
|
2$
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/gcd$ ./gcd 42 12
|
||
|
6
|
||
|
student@ubuntu:~/[[ROOT]]/gcd$ ./gcd 14 77
|
||
|
7
|
||
|
student@ubuntu:~/[[ROOT]]/gcd$ ./gcd 17 3
|
||
|
1
|
||
|
student@ubuntu:~/[[ROOT]]/gcd$ ./gcd
|
||
|
student@ubuntu:~/[[ROOT]]/gcd$ ./gcd 50 12 4
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/gcd$
|
||
6 years ago
|
```
|