So this is a simple C code that should only exit from the loop when i press any other key except "i" or "e", but for some reason even if you press "i" or "e" the program enters the last else statement. I really don't know why this is happening, i've tried using while instead of for, and getchar instead of scanf but it still won't work. The "printf("$");"
at the end is to show me that it reaches that else statement.
 Can anyone please help me understand why this is happening?

```
for(;;)
{
    scanf("%c",&c);
    if(c=='i')
    {
        printf("insert\n");
    }
    else if(c=='e')
    {
        printf("elim\n");
    }
    else 
    {
        printf("$");
                    break;                        
    }

}

```