解题思路:
注意事项:
参考代码:
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
String str = sc.nextLine();
str = str.replace(" ","");
switch(str)
{
case "+": System.out.println(a+b);break;
case "-": System.out.println(a-b);break;
case "*": System.out.println(a*b);break;
case "/": System.out.println(a/b);break;
case "%": System.out.println(a%b);break;
}
}
0.0分
0 人评分
点我有惊喜!你懂得!浏览:3885 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:692 |
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:683 |
2006年春浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:820 |
Pascal三角 (C语言代码)浏览:1188 |
WU-复数求和 (C++代码)浏览:2015 |
IP判断 (C语言代码)浏览:763 |
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:558 |
钟神赛车 (C语言代码)浏览:598 |
1052题解(链表操作)浏览:674 |