package com.SC;
import java.util.Scanner;
public class operate {
/**
* 做一個(gè)簡(jiǎn)單的計(jì)算器
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double sum = 0;//初始化sum值
System.out.println("請(qǐng)輸入第一個(gè)數(shù):");
double num1 = sc.nextDouble();
System.out.println("請(qǐng)輸入運(yùn)算符(+,-,*,%,/):");
String operat = sc.next();
System.out.println("請(qǐng)輸入第二個(gè)數(shù):");
double num2 = sc.nextDouble();
if(operat.equals("+")){
sum = num1+num2;
}else if(operat.equals("-")){
sum = num1-num2;
}else if(operat.equals("*")){
sum = num1*num2;
}else if(operat.equals("%")){
sum = num1%num2;
}else if(operat.equals("/")){
sum = num1/num2;
}
System.out.println(sum);
}
}