I'm making a simple calculator in C and I want the program to show the message "Enter an operator!" when the user enters something that isn't an operator, enter, space or tab. but if the user enters a number like 123 the message is shown 3 times instead of once. how can I fix this?
char op;
printf("please choose an operator (+,-,*,/): ");
while (op!='+' && op!='*' &&op!='-' &&op!='/' )
{
if (op!='\n'&& op!= '\t'&& op!=' ')
printf ("Enter an operator!\n");
scanf ("%c",&op);
}