求两个数的最小公倍数

#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);
}
posted @ 2007-01-14 16:42  齐心  Views(663)  Comments(0Edit  收藏  举报