Software engineering in the eyes of the Lough (pr. Law)
This software engineering's thoughts on technology, careers, and so on.
Wednesday, September 10, 2014
Even Multiple Challenge
Yet another challenge from
http://projecteuler.net
https://projecteuler.net/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?
int
sum = 0;
for
(
int
i = 1; i < 1000; i++) {
if
( i % 5 == 0 || i % 3 == 0) {
sum += i;
}
}
System.out.println(sum);
Code Formatted by ToGoTutor
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)

## No comments:

## Post a Comment