- 思路:
直接 轮询的乘,到最大 就是两数相乘;记得获取到第一个就return退出 程序。
import java.util.*;
public class Main{
public static void main(String args []){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int mul = 0;
int mul2 = 0;
for(int i=1;i<=a;i++){
mul = b * i;
for(int j=1;j<=b;j++){
mul2 = a * j;
if(mul == mul2){
System.out.println(mul);
return;
}
}
}
}
}