运行以下代码:
>>cargo build --release
附:程序源代码
fn gcd(m: u64, n: u64) -> u64 {
assert!(m != 0 && n != 0);
if m > n {return gcd(m - n, n)};
if m < n {return gcd(n - m, m)};
m
}
#[test] fn test_gcd(){
assert_eq!(gcd(14, 15), 1);
assert_eq!(gcd(2 * 3 * 5 * 11 * 17, 3 * 7 * 11 * 13 * 19), 3 * 11);
}
fn main() {
println!("gcd(12, 8) = {}", gcd(12, 8));
}