求两个数的最小公倍数
#include <stdio.h>
#include <conio.h>
int divisor(int a,int b)
{
int r;
while ((r=a%b)!=0)
{a=b;b=r;}
return b;
}
int multiple(int a,int b)
{
int d;
d=divisor(a,b);
return a*b/d;
}
void main()
{
int a,b,c;
clrscr();
printf("Input a b:");
scanf("%d,%d",&a,&b);
c=multiple(a,b);
printf("c=%d",c);
}
#include <conio.h>
int divisor(int a,int b)
{
int r;
while ((r=a%b)!=0)
{a=b;b=r;}
return b;
}
int multiple(int a,int b)
{
int d;
d=divisor(a,b);
return a*b/d;
}
void main()
{
int a,b,c;
clrscr();
printf("Input a b:");
scanf("%d,%d",&a,&b);
c=multiple(a,b);
printf("c=%d",c);
}