首页 > 其他 > 详细

第十章:for循环语句

时间:2020-06-05 15:32:59      阅读:42      评论:0      收藏:0      [点我收藏+]

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

 

第十章:for循环语句

原文:https://www.cnblogs.com/wangqiangya/p/13049632.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!