CopyPastor

Detecting plagiarism made easy.

Score: 0.7864153385162354; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2014-08-28
by Humphrey

Original Post

Original - Posted on 2014-02-15
by Satish Sharma



            
Present in both answers; Present only in the new answer; Present only in the old answer;

I modified Rinto's answer just for those who don't want to use the prompt method and just want to see the program print prime numbers . its working
for (n = 0; n < 100; n++) { var x = 1; if (n == 0 || n == 1) x = 0; for (i = 2; i < n; i++) { if (n % i == 0) { x = 0; break; } } if (x == 1) { // if prime print the numbers document.write(n); } else { // if not prime print the number do nothing } }
check the number is prime or not with JS function
function isPrime(num) { var flag = true; for(var i=2; i<=Math.ceil(num/2); i++) { if((num%i)==0) { flag = false; break; } } return flag; }

        
Present in both answers; Present only in the new answer; Present only in the old answer;