In your case your scanf reads newline character into &operator in the second invocation. To skip blank characters, try to use:
scanf(" %c%f", &operator, &number);
instead. I.e. put one space character at the beginning of your format. It may be a good idea to put one space also between %c
and %f
.