Hi everyone!

I've tried to develop a simple programm which will tell the user if the given number is a prime number or not.

this is the method I've been trying to fix:

public void checkIfPrime(Double d){ Double TestTo = d; for(int x=1; x<TestTo; x++){ if(d / x == 1.0 && foundDivs == 0){ primeNoYes = "yes"; foundDivs++; } else {primeNoYes = "no";} } }

What I'm basically trying to do is to calculate how many numbers the given number can be divided with that equals 1. Since a prime number only has two numbers it can be divided by, which is 1 and itself. As you can see I'm ignoring the 1 for now as it's unnessisary, i think.

and then the programm gives a message box that says "Yes if the number onlt has one number divided by which gives 1 and reverse.

At least that what I thought would work, but it didn't...

Any help, what would you do?