HDU-1108 最小公倍数添加链接描述
#include<stdio.h>
int main (void)
{
int a,b,t,max,a1,b1;
while(scanf("%d %d",&a,&b)==2){
max=1;
a1=a;
b1=b;
while(max!=0){
if(a1<b1){
max=b1%a1;
b1=a1;
a1=max;
}
else{
max=a1%b1;
a1=b1;
b1=max;
}
}
if(a1!=0) max=a1;
else max=b1;
t=a*b/max;
printf("%d\n",t);
}
return 0;
}