两个数的简单计算器 (10分)
程序员文章站
2022-06-07 15:15:05
...
#include<stdio.h>
int main()
{
int x,y;
char n;
scanf("%d %c %d",&x,&n,&y);
switch(n){
case'+':printf("%d\n",x+y);break;
case'-':printf("%d\n",x-y);break;
case'*':printf("%d\n",x*y);break;
case'/':printf("%d\n",x/y);break;
case'%':printf("%d\n",x%y);break;
default:printf("ERROR");break;}
}