Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Java by paigethorn ( 5 years ago )
/**
 * Write a description of class Primes here.
 *
 * @paigethorn
 * 5/6/21
 */
public class Primes
{
    public static void main(String[]args)
    {
        int factorcount = 0;
        System.out.println("The prime numbers are");
        for(int num = 0; num < 10000; num++)
        {
            for(int factor = 1; factor < num; factor++)
            {
                if(num % factor == 0)
                {
                    factorcount++;
                }
            }
            if(factorcount == 2)
            {
                System.out.print(Math.sqrt(num) + " ");
            }
            factorcount = 0;
        }
        System.out.println();
        }
    }

 

Revise this Paste

Your Name: Code Language: