1
0
Fork 0
cp-templates/number/gcd.rs

6 lines
98 B
Rust
Raw Normal View History

2024-01-02 16:42:07 +08:00
let gcd = |mut x: i64, mut y: i64|{
while y != 0 {
(x, y) = (y, x % y);
}
x
};