when you try to use the following function for the first time it will give you correct answer which gives you the LCM of two numbers ( Least common multiple ). for the second call with new parameters the static variable wont be starting at 1 which is going to give me wrong answer. is there anyway to set it up to 1 before doing his recursive loop ?
int lcm(int a, int b)
{
static int common = 1;
if (common % a == 0 && common % b == 0)
return common;
common++;
lcm(a, b);
return common;
}