#include <stdio.h>
int gcd(int a,int b)
{int temp;
if (a<b)
{temp=a;
a=b;
b=temp;
}
while(b!=0)
{temp=a%b;
a=b;
b=temp;
}
return a;
}
main()
{int a,b;
scanf("%d%d",&a,&b);
printf("zuidagongyueshu\n:%d",gcd(a,b));
printf("zuixiaogongbeishu\n:%d",a*b/gcd(a,b));
}
上面是求2个数最大公约数和最小公倍数,求1-2-3...100的积,出来的数据太大,难于存储
追问我操作过,不正确