C#动态二维数组输出

时间:2022-04-07 15:32:05
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
Console.Write("请输入动态数组的行数:");
int row = Convert.ToInt32(Console.ReadLine());
Console.Write("请输入动态数组的列数:");
int col = Convert.ToInt32(Console.ReadLine());
int[,] arr = new int[row, col];
Console.WriteLine("结果:");
for(int i=0;i<row;i++)
{
for (int j=0;j<col;j++)
{
Console.Write(i+j.ToString()+" ");//" "是空格
}
Console.ReadLine();
} }
}
}