#include <stdio.h>
int main() {
char op;
double a,b;
printf("enter your operator ('+' '-' '*' '/'): ");
scanf("%c",&op);
printf("\nenter two numbers: ");
scanf("%lf%lf", &a, &b);
switch (op){
case'+':
printf("\n%.1lf+%.1lf=%.1lf", a,b,a+b);
break;
case'-':
printf("\n%.1lf-%.1lf=%.1lf", a,b,a-b);
break;
case'*':
printf("\n%.1lf*%.1lf=%.1lf", a,b,a*b);
break;
case'/':
printf("\n%.1lf/%.1lf=%.1lf", a, b, a/b);
break;
default:
printf("\nenter a valid input");
break;
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: