#include <stdio.h>
int main()
{
int data1,data2,result;
float r;
char op;
scanf("%d %d %c",&data1,&data2,&op);
switch(op)
{
case '+':result=data1+data2;printf("%d",result);break;
case '-':result=data1-data2;printf("%d",result);break;
case '*':result=data1*data2;printf("%d",result);break;
case '/':r=(float)data1/data2;if(data1%data2==0)
{
printf("%.0f",r);
}
else printf("%.2f",r);break;
}
return 0;
}
简易计算器
最新推荐文章于 2024-11-11 08:43:45 发布