I have been trying to get a program together that prompts user to enter a min and max number... it then determines the primes between the min and max numbers...

I got help here with the prime part but I am having trouble trying to determine if the min number is > 1 and the max num is > than the min number before it loops through the prime determining iteration...

I am learning from a book and I must be missing something or not putting enough time into coding to make it sink in... here is what I have so far:

#include <stdio.h>

#include <stdlib.h>

int main()

{

int min_num;

int max_num;

int num;

int prime;

int i;

int j;

printf("Enter two numbers greater than 0 - seperated by a space: ");

while ((num = scanf("%i %i", &min_num, &max_num)) == 2)

{

if(min_num > 1 && min_num < max_num);

for(i=min_num; i<=max_num; ++i)

{ prime=1; /* assert i is prime */

for(j=2; j<=i/2; ++j)

{

if(i%j==0)prime=0;

}

if(prime)printf("%d is prime\n",i);

}

else printf("You must enter a minimum number > 1 and less than the max number!");

}

if (num != EOF)

printf("Warning: Encountered error in reading input. \n");

return EXIT_SUCCESS;

}

Would it be best to creat a function to compute the primes? Also, I am having trouble when errors are encountered of getting the program to kick back to the scanf prompt asking for input...

Thanks,

mapper