编程题: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");
    }
}

}

posted on 2025-05-12 23:21  Swishy  阅读(7)  评论(0)    收藏  举报