第十章:for循环语句

for循环语句的固定代码是:

for(int  i=0;i<length;i++)

{

}

(初始化第一次执行,并且只执行一次,计数器第一次不执行:因为第一次知道自己的值)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace for循环语句1
{
    class Program
    {
        static void Main(string[] args)
            //int i=0(计算器初始化)
            //i<length(根据计数器来判断条件是否成立)(length:长度的意思)
            //i++(对计数器的操作)
        {
            for (int i = 1; i <=9; i++)
            {
                // 循环语句
                Console.WriteLine(i);
            }
            Console.Read();
        }
    }
}
原文地址:https://www.cnblogs.com/wangqiangya/p/13049632.html