Case 1:
printf("Enter the operation you want to carry out (+, -, /, *): ");
scanf("%c", &operator);
printf("Enter two numbers: ");
scanf("%lf %lf", &num_1, &num_2);
In this case, the program was executed smoothly.
Case 2:
printf("Enter two numbers: ");
scanf("%lf %lf", &num_1, &num_2);
printf("Enter the operation you want to carry out (+, -, /, *): ");
scanf("%c", &operator);
In this case, after I entered the numbers, it directly executed the rest of the program and the default error message was printed.