请在JAVA中,用递归算法计算下面的题目
收起
知与谁同
2018-07-15 16:06:53
1360
0
1
条回答
写回答
取消
提交回答
-
package test;
public class CircleMt {
public static int operate(int a ,int b,String operation){
if(operation.equals("+")){
return a+b;
}else if(operation.equals("-")){
return a-b;
}
return 0;
}
public static void main(String[] args) {
System.out.println(operate(operate(operate(1,4,"+"),2,"+"),3,"-"));
}
}
2019-07-17 22:55:25