C# 循环

C#循环

代码

csharp 复制代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Test
    {
        static void Main(string[] args)
        {
            int a = 5;
            int[] b = { 1, 2, 3, 4, 5, 6, 7, 8 };
            int c = 0;
            for (int i = 0; i < a; i++)
            {
                Console.WriteLine("i:" + i);
            }
            foreach (var item in b)
            {
                Console.WriteLine("b[" + c++ +"]:" + item);
            }
            Console.ReadLine();
        }
    }
}

运行结果

相关推荐
kybs199114 小时前
全球灾害数据分析可视化 毕业设计-附源码66794
vue.js·spring boot·mysql·安全·django·c#·asp.net
Polevne18 小时前
C# SFTP客户端实现文件传输
c#·ssh
samble18 小时前
从零搭建灌装监控系统(四):深色主题与样式系统,ResourceDictionary 统一管理
c#·wpf·mvvm·样式·工业控制
cjp56019 小时前
024 . WPF MVVM类封装优化
c#
淡海水1 天前
13-04-面试-源码级深度追问链
数据结构·unity·面试·c#·游戏引擎·源码·il2cpp
asdzx671 天前
如何使用 C# 提取 PPT 文本与图片
c#·ppt·提取文本
2501_930707782 天前
使用C#代码使用条件格式为 Excel 隔行设置颜色
c#·excel
何以解忧唯有撸码2 天前
【开源】c#造个轮子-日程安排工具
c#·自定义控件
周杰伦fans2 天前
CAD菜单栏和工具栏都不见了,怎么显示?
其他·c#
曹牧2 天前
C#:HashSet<T> 去重
c#