Check the return value of scanf(); scanf() returns the number of items succesfully read. That is, for scanf("%f"), the return value will be 1 if all was successful or something else (0 or EOF). For scanf("%f%f%f"), the return value could be from 1-3 (or 0 or EOF), indicating how many numbers were read successfully.
If scanf() detects an error, remove the offending characters from the input stream and resume reading. Something like this:
Code:
int c; /* must be an int to hold EOF */
double percent;
printf("Enter your percent: ");
while(scanf("%lf", &percent) != 1) {
printf("Try again: ");
while((c = getchar()) != EOF && c != '\n');
}