So I'm trying to make a simple calculator that allows the user to use the program again without quitting. Now the loop itself works fine, however when I use printf() it repeats it again like this and skips it:
Enter an operator: +
Do you want to continue?(Y/N): y
Enter an operator: 
Do you want to continue?(Y/N): 
Here's the code:
int main()
{
    char o, ans = 'Y';
    int num1, num2;
    while(ans == 'Y' || ans == 'y')
    {
        printf("\nEnter an operator: ");
        scanf("%c", &o);
        printf("\nDo you want to continue?(Y/N): ");
        scanf(" %c", &ans);
    }
    return 0;
}
 
     
    