java 一道算法题2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?public static int getA(int

来源:学生作业学帮网 编辑:学帮网 时间:2024/05/09 03:38:13

java 一道算法题
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
public static int getA(int m,int n){ //求最大公约数
\x05\x05int up=m

public static void main(String[] args){
boolean flag = true;
int i = 0;
int j = 1;
while(flag){
j = 1;
i++;
while(i%j==0){
j++;
if(j>20){
flag = false;
}
}
}
//验证结果
for(int w = 1;w