15 lines
171 B
Plaintext
Raw Normal View History

2024-07-30 14:36:33 +00:00
import log
main() {
log.number(gcd(1071, 462))
}
2024-08-05 16:47:24 +00:00
gcd(a Int, b Int) -> Int {
2024-07-30 14:36:33 +00:00
loop {
2024-08-03 21:32:47 +00:00
switch {
a == b { return a }
a > b { a -= b }
_ { b -= a }
2024-07-30 14:36:33 +00:00
}
}
}