import java.util.Scanner;
//作业 计算器
public class Demo06 {
public static void main(String[] args) {
Scanner a = new Scanner(System.in);
Scanner b = new Scanner(System.in);
Scanner c = new Scanner(System.in);
int a1 = a.nextInt();
String b1 = b.next();
int c1 = c.nextInt() ;
switch (b1) {
case ("+") -> {
int x = a1+c1;
System.out.println(x);
}
case ("-") -> {
int x2 = a1-c1;
System.out.println(x2);
}
case ("*") -> {
int x3 = a1*c1;
System.out.println(x3);
}
case ("/") -> {
int x4 = a1/c1;
System.out.println(x4);
}
default -> System.out.println("error");
}
}
}
java计算器简易版
最新推荐文章于 2024-09-27 00:45:01 发布