Skip to content

Commit

Permalink
add problem 1 in javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
Barry Mulling authored and Barry Mulling committed Sep 13, 2018
1 parent c271cba commit b69a106
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions javascript/001/problem_1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
*/
sum = 0;
for (i = 1; i < 1000; i++ ) {
if (i % 3 == 0 || i % 5 == 0) {
sum += i;
}
}
console.log(sum)

0 comments on commit b69a106

Please sign in to comment.