#include <stdio.h>
int maxgongyueshu(int,int);
int mingongbeishu(int,int);
int main(int argc, int *argv[])
{
int a,b;
printf("please input 2 numbers:");
scanf("%d,%d",&a,&b);
printf("the maxgongyueshu : %d ,the mingongbeishu : %d",
maxgongyueshu(a,b),mingongbeishu(a,b));
system("pause");
return 0;
}
int maxgongyueshu(int m,int n)
{
int a,b,temp;
if (m >= n)
{
a = m;
b = n;
}
else
{
a = n;
b = m;
}
do
{
temp = a % b;
a = b;
b = temp;
}while (b);
return a;
}
int mingongbeishu(int m,int n)
{
return m * n / maxgongyueshu(m,n);
}
|