should the n in your code be an i? I cannot get this to work
EDIT: nevermind, this somewhat works, I have it print out that all numbers in my range are prime. here is code:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main (void)
{
//declare variables
int n, is_prime, Start, Stop, display_factor, i, Lower, Upper;
printf("Enter lower range:");
scanf("%d", &Lower);
printf("Enter upper range:");
scanf("%d", &Upper);
//loops until it reaches the End Of File
if (Lower != Upper)
{
is_prime = 1;
for(n = Lower; n <= Upper; n++)
{
if ((n%i) == 0)
{
is_prime = 0;
}
else
{
printf("%d: PRIME Number\n\n", n);
}
}
}
return 0;
}