📅  最后修改于: 2022-03-11 15:04:42.405000             🧑  作者: Mango
#include
#include
int main()
{
float a,b,s;
char d;
printf("choose an operation btwn + - * / : ");
scanf("%c",&d);
switch(d){
case '+' :
printf("enter two numbers ");
scanf("%f%f",&a,&b);
s = a + b ;
printf("%.1f + %.1f = %.1f",a,b,s);
break;
case '-' :
printf("enter two numbers ");
scanf("%f%f",&a,&b);
s = a - b ;
printf("%.1f - %.1f = %.1f",a,b,s);
break;
case '*' :
printf("enter two numbers ");
scanf("%f%f",&a,&b);
s = a * b ;
printf("%.1f * %.1f = %f",a,b,s);
break;
case '/' :
printf("enter two numbers ");
scanf("%f%f",&a,&b);
s = a / b ;
printf("%.1f / %.1f = %.1f",a,b,s);
break;
default :
printf("enter a valid operation !");
break;
}
return 0;
}