解题思路:
注意事项:
参考代码:
/******************模拟计算器**********************/
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
String c = sc.next();
switch(c){
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 人评分