标签:int 递归 str ati print return stat static nbsp
利用递归方法求6!
1 package com.test01; 2 3 public class JianDa03 { 4 public static long fac(int i) { 5 if (i == 1){ 6 return 1; 7 } else { 8 return i * fac(i - 1); 9 } 10 } 11 public static void main(String[] args){ 12 long res = fac(6); 13 System.out.println(res); 14 } 15 }
标签:int 递归 str ati print return stat static nbsp
原文地址:https://www.cnblogs.com/0820LL/p/9601922.html