a- public class Test1 {
- public static void main(String[] args) {
- int result = 0;
- result = getResult(3);
- System.out.println(result);
- }
- private static int getResult(int i) {
- int result = 0;
- int temp = i;
- if(i==1)
- return 1;
- result = temp*getResult(temp-1);
- return result;
- }
- }
复制代码
|
|