function DisplayPrimeNumbers(number)
    {
        var this_number,divisor,not_prime;
        this_number = 3;
        while(this_number < number)
        {
            divisor = parseInt( this_number / 2);
            not_prime = 0;
            while(divisor > 1)
            {
                if(this_number % divisor == 0)
                {
                   not_prime = 1;
                   divisor = 0;
                }
                else
                {
                    divisor = divisor - 1;
                }
            }
            if(not_prime == 0)
            {
                document.writeln(this_number + " is a prime number </br>");
            }
            this_number = this_number + 1;
        }
       
    }
1
Contributor
0
Replies
1
Views
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.