WIN-TC运行OK 其他的应该没问题
#include
#define size 5 /*多少组自己改,我设5组*/
void main()
{
int a[size],b[size],i,m=1,n,x;
for(i=0;i
scanf("%d%d",&a[i],&b[i]);
}
printf("\n\n");
for(i=0;i
else n=a[i];;
x=a[i]*b[i];
while(m
if(a[i]%m==0&&b[i]%m==0)
x=x/m;
m++;
}
printf("NO:%d %d\n",i+1,x);
}
getch();
}
/*一组一组输入,如:2 4(回车) 中间有空格 */
满意给分
#include
int MinDouble(int a,int b)
{
int i;
if(a {
i=a;
a=b;
b=i;
}
while((i=a%b)!=0)
{
a=b;
b=i;
}
return b;
}
int main(void)
{
int a,b;
while(scanf("%d%d",&a,&b)==2)
{
printf("最小公倍数是:%d\n",a*b/MinDouble(a,b));
}
return 0;
}
int c=b;
if(b%a==0) cout<<"it is "< else do{
c++;
}while(c%a!=0||c%b!=0)
cout<<“公倍数”<