I see two mistakes in there:
1) You keep on looping even after you find out that the number isn't prime
2) Your line "if (increase == div)" is logically wrong! Try something like:
if...
Type: Posts; User: GReaper
I see two mistakes in there:
1) You keep on looping even after you find out that the number isn't prime
2) Your line "if (increase == div)" is logically wrong! Try something like:
if...
Maybe you should add some curly braces like:
int numbers(int value1, int value2)
{
int div=2;
while (value1<=value2)
{
int increase=1;
while (div<=value1 && value1%div !=0)...
while (value1<=value2); This will be an infinite loop if "value1 <= value2"!
Yeah, better and pretty faster too!