HDOJ1108【最小公倍数。。】
#include <stdio.h>
int lcm(int a,int b)
{
int s,g,l;
g = a>b?a:b;
l = a>b?b:a;
s = g;
while (1)
{
if (s%l==0)
return s;
s+=g;
}
}
int main()
{
int a,b;
while (scanf("%d%d",&a,&b)!=EOF)
printf("%d\n",lcm(a,b));
}
找我内推: 字节跳动各种岗位
作者:
ZH奶酪(张贺)
邮箱:
cheesezh@qq.com
出处:
http://www.cnblogs.com/CheeseZH/
*
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。