#include<stdio.h>
int main()
{
int N,M,t;
scanf("%d%d",&N,&M);
int a,b;
a=N*M;
if(N>M){
t=N;N=M,M=t;
}
while(N!=0){
t=M%N;M=N;N=t;
}
b=a/M;
printf("%d %d",M,b);
return 0;
}
转载于:https://www.cnblogs.com/yhy520/p/9815360.html
#include<stdio.h>
int main()
{
int N,M,t;
scanf("%d%d",&N,&M);
int a,b;
a=N*M;
if(N>M){
t=N;N=M,M=t;
}
while(N!=0){
t=M%N;M=N;N=t;
}
b=a/M;
printf("%d %d",M,b);
return 0;
}
转载于:https://www.cnblogs.com/yhy520/p/9815360.html