怎样用foreach输入二维数组几行几列
static void Main(string[] args){
int[,] arr = {{1,2,3},{4,5,6},{7,8,9} };
foreach (int i in arr)
{
输出的结果是
123
456
789
}
}
int[,] arr = {{1,2,3},{4,5,6},{7,8,9} }; int count = 0; foreach (int i in arr) { Console.Write(i); count++; if (count%3==0) { Console.Write('\n'); } }