Anonymous user
Greatest common divisor: Difference between revisions
m
→{{header|Rust}}
mNo edit summary |
|||
Line 3,053:
=={{header|Rust}}==
===num crate===
<lang
use num::integer::gcd;</lang>
===Iterative Euclid algorithm===
<lang
while m != 0 {
let old_m = m;
Line 3,067:
===Recursive Euclid algorithm===
<lang
if m == 0 {
n.abs()
Line 3,076:
===Tests===
<lang
println!("{}",gcd(399,-3999));
println!("{}",gcd(0,3999));
|