zoukankan      html  css  js  c++  java
  • 递归的基本练习

            做梦N层
            static void Main(string[] args)
            {
                Test(1);
            }
            static void Test(int n)
            {
                if (n > 10)
                {
                    return;
                }
                Console.WriteLine("正在做第{0}层梦", n);
                Test(n + 1);
                Console.WriteLine("第{0}层梦醒了", n);
            }

    猴子吃桃子,每天吃一半然后扔掉一个,问第一天有多少

            static void main(string[] args)
            {
                program hanshu = new program();
                int a = taozi(1);
                console.writeline(a);
            }
            static int taozi(int day)
            {
                if (day == 7)
                {
                    return 1;
                }
                int n = (taozi(day + 1) + 1) * 2;
                return n;
            }

  • 相关阅读:
    css文本及文本装饰
    css尺寸常用样式
    了解css的两大特性
    css长度单位及字体
    css颜色
    css选择器详解
    了解css
    html行级元素与块级元素以及meta标签的使用
    了解html表单
    html图片和html实体
  • 原文地址:https://www.cnblogs.com/UC0079/p/5491759.html
Copyright © 2011-2022 走看看