The main problem I see from my tipsy state is that e needs moving into the loop. It is only calculating b mod a once, for the initial value of a (So it only checks if the number is divisible by 2)
The rest of my comments are regarding style and are probably not required to get a working program...
Also, why are you using a value of d of half b? Wouldn't sqrt ( b ) would be better by some huge order of magnitude?
Rather than trying to work out when the loop stops, why not just have a flag? Start by assuming b is prime, then test this assumption for all values in
N+ less than or equal to sqrt( b ) , and if you find a value where it isn't set the flag to false (0) and break from the loop. Then you can give output at the end of the program depending on the value of the flag. This simplifies everything.
The continue is redundant.
Also, this line
for(a; a>=1 && a<=d; a++){
You know a is initially 2. a++ (The only write operation on a) ensures a is increasing. Hence a>=1 is redundant as it is always true. True && a <= d can be simplified to a <= d
IMHO try not to use letters a b c et al that don't describe what the variable does. It is really confusing as to what they do when the scope of the variables (In this case, the function that the variables are defined in) is more than a few lines. The exception is i,j,k when used in loops over an array as it is very common to do so. (Including in maths, which is I assume where it stemmed from)
Example of something closer to what I would write:
#include #include int main(){ int divisor, possible; float limit; int prime = 1; printf("Enter your number:"); scanf("%d", &possible); limit=sqrt(possible); for( divisor = 2; divisor <= limit; divisor++){ if ( possible % divisor == 0 ){ prime = 0; break; } } if ( prime ){ printf("Your number is prime."); }else{ printf("Your number is not prime. It is divisible by %d.", divisor); } return 0;}