[][src]Function rust_algorithm::gcd

pub fn gcd(int1: i32, int2: i32) -> i32

求两个数的最大公约数(greatest common divisor)

Arguments

  • int1 - 第一个数
  • int2 - 第二个数

Examples

use rust_algorithm::gcd;
let result = gcd(8, 4);
assert_eq!(result, 4);