编程题:12
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int num1 = scanner.nextInt();
String op = scanner.next();
int num2 = scanner.nextInt();
switch (op) {
case "+":
System.out.println(num1 + num2);
break;
case "-":
System.out.println(num1 - num2);
break;
case "*":
System.out.println(num1 * num2);
break;
case "/":
System.out.println(num1 / num2);
break;
case "%":
System.out.println(num1 % num2);
break;
default:
System.out.println("ERROR");
}
}
}
浙公网安备 33010602011771号