EDIT: rewind() is a thing. I didn't know. But anyway, what you should do is:
if(scanf("%d", &rAns)==0){
printf("enter right answer\n");
rewind(stdin);
}
it should be:
char rAns = 0;
while(!scanf("%d", &ans)) {
printf("Please input a number.\n");
}
Now it loops while the input is invalid.
You can now remove the else { }.