如有两个数a1,a2:
int t,s;
t = a1 > a2 ? a2 : a1;
for (;t>=1;t--)
    if (a1%t==0 && a2%t==0)
        break;
s = a1 * a2 / t;
t为最大公约数,s为最小公位数。