Pure Programmer
Blue Matrix


Cluster Map

Project: GCD

The [[Greatest_common_divisor|greatest common divisor]] (GCD) of two integers can be computed with a recursive function by using Euclid's algorithm. Basically if two integers a and b are such that a > b, then the GCD(a, b) is equal to the GCD(a - b, b). Keep reducing the problem through recursion until a = b which is the answer.

Output
$ rustc GCD.rs error: expected one of `.`, `;`, `?`, `else`, or an operator, found `,` --> GCD.rs:18:21 | 18 | let mut a:isize = 6, b:isize = 9; | ^ expected one of `.`, `;`, `?`, `else`, or an operator error: aborting due to previous error

Solution