Added NodeJS javascript solutions
This commit is contained in:
@ -18,3 +18,6 @@ solutions:
|
||||
solve.c:
|
||||
desc: ANSI C solution (Tested with TCC)
|
||||
language: c
|
||||
solve.js:
|
||||
desc: NodeJS solution
|
||||
language: javascript
|
||||
|
9
ProjectEuler/001/solve.js
Normal file
9
ProjectEuler/001/solve.js
Normal file
@ -0,0 +1,9 @@
|
||||
sum = 0;
|
||||
i = 0;
|
||||
for(i=1; i<1000;i++) {
|
||||
if(i % 3 == 0 || i % 5 == 0) {
|
||||
sum += i;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(sum);
|
@ -19,3 +19,6 @@ solutions:
|
||||
solve.c:
|
||||
desc: ANSI C solution (Tested with TCC)
|
||||
language: c
|
||||
solve.js:
|
||||
desc: NodeJS solution
|
||||
language: javascript
|
11
ProjectEuler/002/solve.js
Normal file
11
ProjectEuler/002/solve.js
Normal file
@ -0,0 +1,11 @@
|
||||
sum = 2;
|
||||
fib = new Array( 1, 2, 3 );
|
||||
while(fib[2] < 4000000)
|
||||
{
|
||||
fib[2] = fib[0] + fib[1];
|
||||
if(fib[2] % 2 == 0)
|
||||
sum += fib[2];
|
||||
fib[0] = fib[1];
|
||||
fib[1] = fib[2];
|
||||
}
|
||||
console.log(sum );
|
Reference in New Issue
Block a user