+ 2
Many ways to do that. You might try to determine which of the two numbers is lower and then iterate from 1 to half this number (or the whole number, if you allow itself to be the PGCD), checking if the iterator's modulo of both numbers equals 0. If so, assign it to a variable. After you finish the iteration, return thus variable. It will be the greatest common divisor of the two numbers.
31st Mar 2017, 8:58 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar