#include<stdio.h> int main() { double a = 0.0; double b = 0.0; char c ='0'; scanf("%lf %c %lf",&a,&c,&b); { switch (c) { case '+': printf("%.4lf+%.4lf=%.4lf",a,b,a+b); break; case '-': printf("%.4lf-%.4lf=%.4lf",a,b,a-b); break; case '': printf("%.4lf%.4lf=%.4lf",a,b,a*b); break; case '/': if(b == 0.0) { printf("Wrong!Division by zero!"); } else printf("%.4lf/%.4lf=%.4lf",a,b,a/b); break; default: printf("Invalid operation!"); break; } } return 0; }
#include<stdio.h> int main() { double a = 0.0; double b = 0.0; char c ='0'; scanf("%lf %c %lf",&a,&c,&b);
{
switch (c)
{
case '+':
printf("%.4lf+%.4lf=%.4lf",a,b,a+b);
break;
case '-':
printf("%.4lf-%.4lf=%.4lf",a,b,a-b);
break;
case '*':
printf("%.4lf*%.4lf=%.4lf",a,b,a*b);
break;
case '/':
if(b == 0.0)
{
printf("Wrong!Division by zero!");
}
else
printf("%.4lf/%.4lf=%.4lf",a,b,a/b);
break;
default:
printf("Invalid operation!");
break;
}
}
return 0;
}