Q:

A simple “printing” calculator

When I'm typing in a digit I see
Type in a digit 1
Type in an operator ERROR: Unknown operator!
accumulator = 0.000000
Type in a digit 
Why step - printf("Type in an operator ") is skipped and is replaced by - default:
            printf ("ERROR: Unknown operator!\n");
            break;
Thanks for the help in advance!
// Program to produce a simple printing calculator

#include <stdio.h>
#include <stdbool.h>

int main (void)
{

    double accumulator = 0.0, number; // The accumulator shall be 0 at startup
    char operator;
    bool isCalculating = true;  // Set flag indicating that calculations are ongoing

    printf("You can use 4 operator for arithmetic + - / *\n");
    printf("To set accumulator to some number use operator S or s\n");
    printf("To exit from this program use operator E or e\n");
    printf ("Begin Calculations\n");

    while (isCalculating)   // The loop ends when operator is = 'E'
    {

        printf("Type in a digit ");
        scanf ("%lf", &number);             // Get input from the user.

        printf("Type in an operator ");
        scanf ("%c", &operator);
        // The conditions and their associated calculations
        switch (operator)
        {
        case '+':
            accumulator += number;
            break;
        case '-':
            accumulator -= number;
            break;
        case '*':
            accumulator *= number;
            break;
        case '/':
            if (number == 0)
                printf ("ERROR: Division by 0 is not allowed!");
            else
                accumulator /= number;
            break;
        case 'S':
        case 's':
            accumulator = number;
            break;
        case 'E':
        case 'e':
            isCalculating = false;
            break;
        default:
            printf ("ERROR: Unknown operator!\n");
            break;
        }

        printf ("accumulator = %f\n", accumulator);
    }
    printf ("End of Calculations");

    return 0;
}

A:

scanf for a char consumes the newline characters. So the scanned char is "linefeed" instead of the one you're expecting.
I replaced:
scanf ("%c", &operator);

by
scanf ("%*c%c", &operator);

(consuming linefeed before the operator without assigning it using %*c format)
and your code worked fine.

