image.png
int[,] a = { { 3, 6, 7 }, { 5, 7, 1 }, { 9, 4, 2 } };
int sum = 0;
for (int i = 0; i < a.GetLength(0); i++)
{
for (int j = 0; j < a.GetLength(1); j++)
{
sum += a[i, j];
Console.Write(a[i, j] + "\t");
}
Console.Write(sum + "\t");
Console.WriteLine();
sum = 0;
}
网友评论