标签:
结对项目:四则运算
结对成员:沈柏杉 、程媛媛
1 #include<stdio.h> 2 #include<math.h> 3 int main() 4 { 5 int x,y,result; 6 char z; 7 while(~scanf("%d %d %c",&x,&y,&z)) 8 { 9 10 if(z==‘+‘) 11 result=x+y; 12 if(z==‘-‘) 13 result=x-y; 14 if(z==‘*‘) 15 result=x*y; 16 if(z==‘/‘) 17 result=x/y; 18 if(z==‘%‘) 19 result=x%y; 20 printf("%d %c %d = %d\n",x,z,y,result); 21 22 } 23 24 }
代码运行:
执行结果:
标签:
原文地址:http://www.cnblogs.com/yuanyuancheng/p/5847146.html