Hydrogen-python/test.c
2025-06-11 19:51:42 +08:00

19 lines
313 B
C

/* A program to perform Euclid s Algorithm to compute gcd. */
int gcd(int u, int v) {
if (v == 0) {
return u;
} else {
return gcd(v, u-u/v*v);
}
/* u-u/v*v* == u mod v */
}
void main() {
int x;
int y;
x = input();
y = input();
output(gcd(x, y));
return;
}