import java.util.Scanner;
public class Main {
public static void main (String [] args) {
Scanner sc = new Scanner(System.in);
String [] input = sc.nextLine().split(" ");
int a1 = Integer.parseInt(input[0]);
int a2 = Integer.parseInt(input[2]);
int result = 0;
switch (input[1]) {
case "+" :
result = a1 + a2;
System.out.println(result);
break;
case "-" :
result = a1 - a2;
System.out.println(result);
break;
case "*" :
result = a1 * a2;
System.out.println(result);
break;
case "/" :
result = a1 / a2;
System.out.println(result);
break;
case "%" :
result = a1 % a2;
System.out.println(result);
break;
default:
System.out.println("ERROR");
}
}
}
7-12 两个数的简单计算器 (10 分)
最新推荐文章于 2023-02-18 15:30:18 发布