Loops with boolean variables!

I'm writing a complex for loop to find prime numbers. What I have so far is this:

Quote:

public static void algorithmOne(int n) {

boolean isPrime = true; //the number is a prime (has remainder)

for(int m = 2; m < n; m++) {

for (int c = 2; c < m; c++){

if(m%c == 0) isPrime = false; //is not a prime

}

What I guess I'm trying to achieve is the rest of the loop...but I don't know how :confused:

I'm going to have to continue the loop somehow, end it, and print out the prime numbers.

Help please!

Re: Loops with boolean variables!

Quote:

the rest of the loop

What are the steps that the loop needs to do? You need to research the algorithm for finding prime numbers.

Use code tags, not quote tags, to format the code.