Hi,

Yes, to get max you should use x < y ? y : x

Try this:

/peter

Yes, to get max you should use x < y ? y : x

Try this:

```
class MyClass {
public bool HasComFactor(int x, int y, out int lcf, out int gcf)
{
int max = x < y ? y : x;
bool first = true;
lcf = 0;
gcf = 0;
// Find lcf and gcf
for (int i = 1; i < max/2 + 1; i++)
{
if(((y%i)==0) & ((x%i)==0))
{
if(first)
{
lcf = i;
first = false;
}
gcf = i;
}
}// for
if(lcf != 0)
return true;
else
return false;
}
}// MyClass
```

/peter