Thanks
Also trying to get it such that the process repeats whenever the user inputs 'Y' or 'y' and quits when 'N' or 'n'
Not sure if I'm going about it the right way, thinking I'm making it too complex:
Code:
int main() {
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 > 50000)
{
printf("\nInvalid Input. Enter a Number Between 2 and 50,000: ");
scanf("%d" , &max_Number);
if (max_Number > 2 && max_Number < 50000) {
break;
}
}
Sieve (max_Number);
Palindrome (count);
CPSP (count);
printf("\nIf you would like to run the program with another input, please enter 'Y.' Otherwise, enter 'N' to Quit");
while (getchar() != 'N' || 'n') {
if (getchar() == 'Y' || getchar() != 'y') {
printf("\nEnter a number between 2 and 50,000: ");
scanf("%d" , &max_Number);
while (max_Number < 2 || max_Number > 50000)
{
printf("\nInvalid Input. Enter a Number Between 2 and 50,000: ");
scanf("%d" , &max_Number);
if (max_Number > 2 && max_Number < 50000) {
break;
}
}
Sieve (max_Number);
Palindrome (count);
CPSP (count);
}
}
}