forked from MUSA611-CPLN692-spring2019/cpln692-week3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
part4-project-euler.html
55 lines (36 loc) · 1.06 KB
/
part4-project-euler.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
/* =====================
# Lab 1, Part 4 — Stretch Goal: Project Euler
## Introduction
Practice your Javascript and math skills by solving a problem on Project
Euler. Project Euler is a series of challenging math and computer science
problems that can be solved using any language (for our class, use
Javascript).
Solve the first problem on this page https://projecteuler.net/archives
(Multiples of 3 and 5). To check your answer, create an account and you will
be able to submit your final result.
If you complete problem 1, move on to problem 2!
===================== */
/* =====================
Start code
===================== */
var collect =[];
var sum = 0;
for(var i=1;i<1000;i++){
if (i % 3 === 0 || i % 5 === 0) {
collect.push(i);
sum +=i;
}
};
console.log(sum);
/* =====================
End code
===================== */
</script>
</body>
</html>