#include <stdlib.h>
int main()
{
float num1, num2;
char opt;
printf("enter 1st value: ");
scanf("%f", &num1);
printf("enter 2nd value: ");
scanf("%f", &num2);
printf("choose one operator (+, -, *, /): ");
scanf(" %c", &opt); // " (space) %c" avoid skipping this line
switch(opt)
{
case '+':
printf("%f %c %f = %f\n", num1, opt, num2, num1+num2);
break;
case '-':
printf("%f %c %f = %f\n", num1, opt, num2, num1-num2);
break;
case '*':
printf("%f %c %f = %f\n", num1, opt, num2, num1*num2);
break;
case '/':
printf("%f %c %f = %f\n", num1, opt, num2, num1/num2);
break;
default:
printf("wrong input\n");
}
system("pause");
return 0;
}