OK, so syntax issues and control structure issues...

You check if x is less than 0. If it is, you print a message. Then you continue running your program. You should either return inside the block, or have an else with the rest of your code in it.

The line:

Code:

divisor = divisor(prime(int));

Is not syntactically correct or needed. Take it out.

I don't think you know how functions work, so I will try to explain briefly. The only way that a function interacts with the calling code is through it's parameter list and what it returns. Variables in the function you call prime have no bearing on prime and vice versa. What happens in the function is completely independent of what's in your main function. A function can be called as many times as you need. The compiler already knows the type of your functions, so you don't need to mention them in your main function at all until you want to use them. You do so by referencing their name, then an open parenthesis, then the variables you are passing as arguments separated by commas, then a close parenthesis. If the function returns a value, you can put a variable and an assignment operator, =, before the call. In the case of returning a boolean, you could just use the function directly in an if as it looks like you were trying to do. For prime, this would look like:

Code:

if(prime(x)) {
//Print that x is prime
} else {
//Print that x is not prime
}

or

Code:

boolean isPrime = prime(x);

Remove

Code:

divisor = divisor+1;

from main and move it into your prime function.

To call your prime function (we've been over this before) you need to pass it x. To do this, you would write:

You already have prime in a conditional, so the boolean returned from prime will be used how you expect.

That will get your main function right.

Your prime function is a bit off. You had the right loop control before with:

Inside prime you need to check the condition:

In an if. if that condition is true, you know something about x and you can return the proper value.

In your while loop you will also have to increment divisor so the behavior of the loop changes with each iteration. That means BEFORE the } ending the while loop you need a statement that increments divisor.

If the while loop finishes, and has not returned (so x % divisor never equalled 0) you know something about x, and you need to return appropriately.

-Lee