diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2020-04-28 13:52:19 +0200 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2020-04-28 13:52:19 +0200 |
commit | 7e77b68f6879917a27a0fa3426b9ceef242a9879 (patch) | |
tree | 55076c95968ee3da80243653d93089cbe17b63f1 | |
parent | d1b1dd013d5f50bcb903a97abe8d1700e6868170 (diff) | |
download | gcd-7e77b68f6879917a27a0fa3426b9ceef242a9879.tar.gz |
Reformat with rustfmt
-rw-r--r-- | gcd.rs | 28 |
1 files changed, 12 insertions, 16 deletions
@@ -1,24 +1,20 @@ use std::env; -fn gcd2(mut a: u64, mut b: u64) -> u64 -{ - while b != 0 { - let c = b; - b = a % b; - a = c; - } +fn gcd2(mut a: u64, mut b: u64) -> u64 { + while b != 0 { + let c = b; + b = a % b; + a = c; + } - a + a } +fn main() { + // XXX skip(1) to skip program name: + let nums = env::args().skip(1).map(|s| s.parse().unwrap()); -fn main () -{ - // XXX skip(1) to skip program name: - let nums = env::args().skip(1).map(|s| s.parse().unwrap()); + let gcd = nums.fold(0, gcd2); - let gcd = nums.fold(0, gcd2); - - println!("{}", gcd); + println!("{}", gcd); } - |