📜  最大公约数迭代 - Rust 代码示例

📅  最后修改于: 2022-03-11 14:49:24.608000             🧑  作者: Mango

代码示例2
#include

int gcd_iter(int u, int v) {
  if (u < 0) u = -u;
  if (v < 0) v = -v;
  if (v) while ((u %= v) && (v %= u));
  return (u + v);
}

int main() {
    printf("Greatest Common Divisor = %i", gcd_iter(115, 230));
}