Facebook
From yusuf kaan demirbaƟ, 4 Months ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 267
  1. const start = 500;
  2. const end = 1000;
  3.  
  4. let listOfPrimeNumber = []
  5. for (var i = start; i < end; i++) {
  6.     if (CalcPrime(i)) {
  7.         listOfPrimeNumber.push(i);
  8.     }
  9. }
  10.  
  11. function CalcPrime(num){
  12.     let isPrime=true
  13.     var count=2
  14.     for(count;count<num;count++ ){
  15.       if(num%count==0){
  16.         isPrime=false
  17.       }
  18.     }
  19.     count=3
  20.     return isPrime
  21. }
  22.  
  23. console.log(listOfPrimeNumber)