can’'t we just do (suppose a and b are 2 numbers and min is minimum of the 2)
for(i=min/2;i<=1;i=i/2)
{ if(i%a==0 && i%b==0)
{ cout<<i;
break;}
}
I think it will be faster than recursive one because in it
- program goes till 0;
- if b>a then 1 iteration is wasted.