mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08:00
Concise version
This commit is contained in:
parent
a82550d66f
commit
2a27e93d1c
@ -2,14 +2,9 @@
|
||||
|
||||
// Euclid's algorithm
|
||||
int GCD(int x, int y) {
|
||||
if (x == y || y == 0)
|
||||
if (y == 0)
|
||||
return x;
|
||||
if (x == 0)
|
||||
return y;
|
||||
if (x > y)
|
||||
return GCD(x-y, y);
|
||||
else
|
||||
return GCD(x, y-x);
|
||||
return GCD(y, x%y);
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
Loading…
Reference in New Issue
Block a user