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
660 B
29 lines
660 B
6 years ago
|
## gcd
|
||
|
|
||
|
### Instructions
|
||
6 years ago
|
|
||
|
Write a program that takes two strings representing two strictly positive
|
||
|
integers that fit in an int.
|
||
|
|
||
6 years ago
|
Display their greatest common divisor followed by a newline (It is always a
|
||
6 years ago
|
strictly positive integer).
|
||
|
|
||
|
If the number of parameters is not 2, display a newline.
|
||
|
|
||
6 years ago
|
Example of output :
|
||
6 years ago
|
|
||
|
```console
|
||
|
student@ubuntu:~/student/gcd$ go build
|
||
|
student@ubuntu:~/student/gcd$ ./gcd 42 10 | cat -e
|
||
|
2$
|
||
|
student@ubuntu:~/student/gcd$ ./gcd 42 12 | cat -e
|
||
|
6$
|
||
|
student@ubuntu:~/student/gcd$ ./gcd 14 77 | cat -e
|
||
|
7$
|
||
6 years ago
|
student@ubuntu:~/student/gcd$ ./gcd 17 3 | cat -e
|
||
6 years ago
|
1$
|
||
|
student@ubuntu:~/student/gcd$ ./gcd | cat -e
|
||
|
$
|
||
|
student@ubuntu:~/student/gcd$
|
||
|
```
|