You're right, once I took the time to sit down and think about it, I came up with this, which seems to work alright.
Thanks,
Tom
Code:
int gcd(int a, int b) {
int remainder;
while (remainder!=0) {
remainder = a % b;
a = b;
b = remainder;
}
return a;
}