Can we simplify it by: (This essentially passes only two numbers).
public int GCD(int value1, int value2)
{
int max = 0;
bool gcdFound = false;
int counter = 1;
if (( value1 <= 1 ) || (value2 <= 1))
return (value1 < value2 ? value1 : value2);
gcdFound = (((value1 % value2 ) == 0 ) || ((value2 % value1 ) == 0 ));
if (gcdFound)
{
return (value1 > value2 ? value2 : value1);
}
max = value1 > value2 ? (value2 / 2) : (value1 / 2);
counter = max + 1;
while ((!gcdFound) && (counter > 1))
{
counter--;
gcdFound = ((value1 % counter) == 0) && ((value2 % counter) == 0);
}
return counter;
}