For integers x y and d we say that d is the greatest common
For integers x, y, and d, we say that d is the greatest common divisor of x and y, written as d = gcd(x, y) if d is the largest number that divides both x and y. Note that it is always the case that gcd(x, y) 1.
Solution
int gcd(int x,int y)
{
int gcd;
for(int i=1;i<=x&&i<=y;i++){
if(x%i==0 && y%i == 0 ){
gcd=i;
}
}
cout<<\" (GCD):\"<<gcd<<endl;
return gcd;
}
