• 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();

  • 相关阅读:
    KVM克隆CentOS6虚拟机后无法启动
    Python socket网络模块
    LNMP的安装--详细版
    CentOS7 二进制安装MySQL5.6.42
    超越线程池:Java并发并没有你想的那么糟糕
    有哪些实用的计算机相关技能,可以在一天内学会?
    如何写出让hr一看就约你面试的简历
    五个最佳编程字体
    Eclipse 的 Debug 介绍与技巧
    Redis时延问题分析及应对
  • 原文地址:https://www.cnblogs.com/power8023/p/5749835.html
Copyright © 2020-2023  润新知