其中运用了最小公倍数与最大公约数乘积等于两数相乘的定理。
1 #include <stdio.h> 2 int main(int argc, char *argv[]) 3 { 4 int a,b,c,d,e; 5 scanf("%d %d",&a,&b); 6 d=a*b; 7 while(b>0) 8 { 9 c=a%b; 10 a=b; 11 b=c; 12 } 13 e=d/a; 14 printf("%d\n",e); 15 return 0; 16 }
时间: 2024-07-29 12:11:28