Skip to content

Create example.js - #39

Open
SenayYakut wants to merge 1 commit into
careercup:masterfrom
SenayYakut:master
Open

Create example.js#39
SenayYakut wants to merge 1 commit into
careercup:masterfrom
SenayYakut:master

Conversation

@SenayYakut

Copy link
Copy Markdown

Might be useful

@SenayYakut

Copy link
Copy Markdown
Author

I like to contribute to the project uploading the example questions and my solutions in javascript

@SenayYakut

Copy link
Copy Markdown
Author

function printPrime(value) {
var primes = [];
for(var i = 2; i < value; i++) {
primes[i] = true;
}
var limit = Math.sqrt(value);
for(var i = 2; i < limit; i++) {
if(primes[i] === true) {
for(var j = i * i; j < value; j += i) {
primes[j] = false;
}
}
}
for(var i = 2; i < value; i++) {
if(primes[i] === true) {
console.log(i + " " + primes[i]);
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant