Monkey eats peach recursion

From , 3 Years ago, written in Java, viewed 125 times.
URL https://pastebin.vip/view/955a1584
  1. package www.zhoushuiping.com;
  2.  
  3. public class ShiJiuTi {
  4.         public static void main(String[] args) {
  5.                
  6.                
  7.                 System.out.println(eat(10,1));
  8.         }
  9.        
  10.        
  11.        
  12.        
  13.         public static int eat(int tianshu,int taozishu) {
  14.                 if(tianshu==0) {
  15.                         return taozishu;
  16.                 }else {
  17.                         tianshu = tianshu -1;
  18.                         return eat(tianshu,(taozishu+1) * 2 ) ;
  19.                 }
  20.         }
  21. }
  22.  

Reply to "Monkey eats peach recursion"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website