错误代码:
#include <stdio.h>
int main() { int a,b,c,d,t,r,f; scanf("%d %d",&a,&b); r=a; f=b; if(a<b) { t=a; a=b; b=t; } d=a%b; while(d!=0) { d=a%b; a=b; b=d; } printf("%d %d",b,r*f/b);
} 正确代码:
#include <stdio.h>
int main() { int a,b,c,d,t,r,f; scanf("%d %d",&a,&b); r=a; f=b; if(a<b) { t=a; a=b; b=t; } d=a%b; while(d!=0) { a=b; b=d; d=a%b; } printf("%d %d",b,r*f/b);
}