zoukankan      html  css  js  c++  java
  • 8.4

    递归

     public int ganyang(int i) 
            {
                int sum=0;
                  if(i==7)
                  {
                      return 2; 
                  }
                     sum = (ganyang(i+1) + 1) * 2;
                     return sum;
            }

     


            public int chitao(int i)
            {
                int sum = 0;
                if (i == 9)
                {
                    return 3;
                }
                sum = (ganyang(i + 1) + 1) *(4/3);
                return sum;
            }                                                                                                                                                                                              
                      
                                                          


            static void Main(string[] args)
            {
                //Program aa = new Program();
                //int sum = aa.ganyang(0);
                //Console.WriteLine("最初赶了{0}只羊.",sum);
                //Console.ReadLine();

                Program aa = new Program();
                int sum = aa.chitao(0);
                Console.WriteLine("最初摘了{0}个桃." , sum);
                Console.ReadLine();

  • 相关阅读:
    webpack管理资源
    webpack缓存
    webpack起步
    openssl命令使用
    linux系统安装中文字体-----
    HTML转成PDF的4个前端方法----但都被我拒绝了,我选择后端方法(这才是吊!)
    HTML页面如何导出pdf
    为什么装了easyless插件,vscode还是不能用?
    JSON格式错误,json_decode中true和JSON_UNESCAPED_SLASHES的用法
    tp5条件判断,in,notin,between,if等
  • 原文地址:https://www.cnblogs.com/power8023/p/5749835.html
Copyright © 2011-2022 走看看