public class Cal {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner i = new Scanner(System.in);
System.out.println("输入一个数");
int a = i.nextInt();
System.out.println("输入二个数");
int b = i.nextInt();
System.out.println("输入运算符");
String s = i.next();
if (s.equals("+")) {
int sum;
sum = a + b;
System.out.println(sum);
} else if (s.equals("-")) {
int sum;
if (a < b) {
sum = b - a;
System.out.println(sum);
} else if (a > b) {
sum = a - b;
System.out.println(sum);
}
} else if (s.equals("*")) {
int sum;
sum = a * b;
System.out.println(sum);
} else if (s.equals("/")) {
if (a < b) {
int sum;
sum = b / a;
if(a==0){
System.out.println(“除数需不为0”);
}
System.out.println(sum);
} else if (a > b) {
int sum = a / b;
System.out.println(sum);
}
}
}
}