projectEuler pro5
Smallest multiple
Problem 5
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?
JAVA:
public class P005 {
public static void main(String[] args){
int sum = 0;
for(int i=1;;i++){
sum= 20*i;
if((sum%11==0)&&(sum%12==0)&&(sum%13==0)&&(sum%14==0)&&(sum%15==0)&&(sum%16==0)&&(sum%17==0)&&(sum%18==0)&&(sum%19==0)&&(sum%20==0)){
break;
}
}
System.out.print(sum);
}
}
posted on 2013-10-09 21:33 Monster_Ch 阅读(173) 评论(0) 编辑 收藏 举报