俩个数的最大公约数和最小公倍数

#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;
}

posted @ 2018-10-19 11:17  微仰丶  阅读(102)  评论(0)    收藏  举报