判断两个数的最小公倍数算法JAVA代码
2021-03-26 00:25
标签:source main lcm tin resource imp pre ann bre package suxueyuanli; import java.util.Scanner; public class Lcm { public static void main(String[] args) { } } 判断两个数的最小公倍数算法JAVA代码 标签:source main lcm tin resource imp pre ann bre 原文地址:https://www.cnblogs.com/llj123/p/13761729.html
System.out.println("请输入两个正整数:");
@SuppressWarnings("resource")
Scanner scan = new Scanner(System.in);
@SuppressWarnings("resource")
Scanner scan2=new Scanner(System.in);
int x=scan.nextInt();
int y=scan2.nextInt();
int sum=0;
for(int i=1;i>0;i++) {
sum=i*y;
if(sum%x==0) {
System.out.println(+x+"与"+y+"的最小公倍数为"+sum);
break;
}
}
文章标题:判断两个数的最小公倍数算法JAVA代码
文章链接:http://soscw.com/index.php/essay/67992.html