For finding the GCD of two positive integers, you can simply write: int gcd(int a,int b) { while((a=a%b)&&(b=b%a)); return a+b; }
Separate names with a comma.