#include<stdio.h>
#include<stdlib.h>
int gcd(int m,int n);
int main()
{
int m,n,lcm;
printf("Enter 2 integers :\n");
scanf("%d,%d",&m,&n);
printf("the Greatest Common Divisor of m,n is %d\n",gcd(m,n));
lcm=m*n/gcd(m,n);
printf("the Least Common Multiple of m,n is %d\n",lcm);
system("pause");
return 0;
}
int gcd(int m,int n)
{
if (m>n){return gcd(m-n,n);}
if (m<n){return gcd(m,n-m);}
if (m==n){return m;}
}
为什么结果不对啊,用的Dev C++!