#include <stdio.h>
long int fact(long int x, long int y)
{
int i,j;
for (i =1; i <= x * y; i++)
{
if (x % y == 0 || y % x == 0)
{
return x > y ? y :x;
break;
}
j = x * i;
if (j % y == 0)
{
return j;
break;
}
}
}
int main()
{
long int n,m,a, b,c,d,k;
printf("请输入四个数:");
scanf_s("%d,%d,%d,%d", &a, &b,&c,&d);
long int fact(long int x, long int y);
n = fact(a, b);
printf("%d\n", n);
m =fact (n,c);
k = fact(m, d);
printf("%d\n", m);
printf("%d\n", k);
return 0;
}
标签:return,公倍数,最小,long,break,int,printf,四个,fact From: https://blog.51cto.com/u_16336886/8551399