min
and max
, to store the minimum and maximum values from the array.min
and max
:
a. While max
is not equal to zero:
i. Set temp
to max
.
ii. Set max
to min
modulo max
(remainder of min
divided by max
).
iii. Set min
to temp
.
b. Return min
as the GCD.