Set one value before you start testing.
Only reset the value when the condition you need to test for is met.
In this case, assume it's prime, set value to IsPrime.
During the test phase, any other factor sets the value to IsNotPrime.
At the end, if value is IsPrime, no other factors have been found.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
if(prime = 1)
that's assigning 1 to prime, not checking equality of 1 with prime.
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396