#include <stdio.h>
#include <stdlib.h>
int main()
{
double num1;
double num2;
char op;
printf("Enter a number: ");
scanf("%lf", &num1);
printf("Enter operator: ");
scanf(" %c", &op); // %c 전에 항상 space 넣어야됨!
printf("Enter a anumber: ");
scanf("%lf", &num2);
if(op == '+'){
printf("%f", num1 + num2);
} else if(op == '-'){
printf("%f", num1 - num2);
} else if(op == '/'){
printf("%f", num1 / num2);
} else if(op == '*'){
printf("%f", num1 * num2);
} else{
printf("Invalid Operator");
}
return 0;
}
Case 0: Success!
Case 1: Invalid Operator