Checking for Invalid Input...Not Working?
Valid input for this program is between 2 and 50,000.
However, whenever I try a number less than 2 or greater than 50,000, it still goes through the functions.
What's wrong? Appreciate the help.
Code:
int max_Number;
printf("This program wills calculate all primes up to the number you specify.\n");
printf("\nEnter a number between 2 and 50,000: ");
scanf("%d" , &max_Number);
while (max_Number < 2 || max_Number > 50,000)
{
printf("Invalid Input. Enter a Number Between 2 and 50,000: ");
scanf("%d" , &max_Number);
if (max_Number > 2 && max_Number < 50,000) {
break;
}
}
Sieve (max_Number);
Palindrome (count);
CPSP (count);
getchar();
}