头文件的尖括号显示不出来,所以改成了双引号。
#include“stdio.h”
#include“stdlib.h”
int gongyueshu(int x,int y);
int gongbeishu(int x,int y);
int main()
{
int
a,b;
scanf("%d,%d",&a,&b);
int
x=gongyueshu(a,b);
printf("最大公约数是%d\n",x);
int
y=gongbeishu(a,b);
printf("最小公倍数是%d\n",y);
return 0;
}
int gongyueshu(int x,int y)
{
if(x<=0||y<=0)
{
printf("没有公倍数!!");
return
0;
}
else
{
int
a,b;
if(x
{
a=x;
b=y;
}
else
if(x>y)
{
a=y;
b=x;
}
else
return
1;
int
res=a%b;
while(res!=0)
{
a=b;
b=res;
res=a%b;
}
return b;
}
}
int gongbeishu(int x,int y)
{
if(gongyueshu(x,y)==0)
{
printf("没有最小公倍数!!");
return 0;
}
else return
(x*y)/(gongyueshu(x,y));
}