天天看點

最大公約數和最小公倍數

#include<stdio.h>

int main()

{

 int a,b,r,m,n;

 printf("Please input two numbers:");

 scanf("%d%d",&a,&b);

 m=a,n=b;

 while(b)

 {

  r=a%b;

  a=b;

  b=r;

 }

 printf("%d he %d de zui da gong yue shuo shi %d\n",m,n,a);

 printf("%d he %d de zui xiao gong bei shuo shi %d\n",m,n,m*n/a);

 //getch();

 return 0;

}

本文轉自terryli51CTO部落格,原文連結: http://blog.51cto.com/terryli/520867,如需轉載請自行聯系原作者

繼續閱讀