I wrote a simple program in Java that I'm running with Eclipse to find prime numbers less than 1000.

Here it is, new edit:

public class primes {

```
public static void main(String[] args) {
    // TODO Auto-generated method stub
    System.out.println("2");
    int n=3;  
    int d=2;
    While(n<1000);
    {
        if (n%d == 0){ //if d is a divisor n is not prime
            n=n+1; //try next number
            d=2; //reset divisor
            }
        else{
            if (d>n/2){ //if there are no divisors up to n/2 n is prime
                System.out.println(n);
                n=n+1; //try next number
                d=2; //reset divisor
                }
            else{
                    d=d+1; //try next divisor
                    }
        }

    }

}

private static void While(boolean b) {
    // TODO Auto-generated method stub

}

```

}

I got it to run this time but it only prints 2 and 3. Is there a way to use this approach but make a modification?