Categories
Math2Calculates the greatest common divisor (GCD) of two numbers.
Contributed by @itsbrunodev
fn gcd(mut a: u32, mut b: u32) -> u32 {
while b != 0 {
let temp = b;
b = a % b;
a = temp;
}
a
}
gcd(10, 15); // 5