findGreatestCommonDivisor method
- int other
Finds the greatest common divisor between this integer and the given integer other
.
The greatest common divisor is the largest positive integer that divides both this integer and other
without leaving a remainder.
Returns the greatest common divisor.
Implementation
int findGreatestCommonDivisor(int other) {
int a = this.round();
while (other != 0) {
var t = other;
other = a % other;
a = t;
}
return a;
}