题解 | #求最小公倍数#
求最小公倍数
http://www.nowcoder.com/practice/22948c2cad484e0291350abad86136c3
//想不起来欧几里得算法,那就无脑用遍历,最小是两数中较大值,最大是两数相乘
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
int a = sc.nextInt();
int b = sc.nextInt();
for(int i = Math.max(a, b); i <= (a * b); i++){
if(((i % a) == 0) && ((i % b) == 0)){
System.out.println(i);
return;
}
}
}
}
}