C# 我需要计算3列的奇数,并显示每列有多少

C# 我需要计算3列的奇数,并显示每列有多少,c#,matrix,C#,Matrix,我需要做一个矩阵6x3,显示每列有多少奇数。这就是我的老师教我做的 for (l = 0; l <= 5; l++) for (c = 0; c <= 2; c++) if (notes[l, c] % 2 != 0) cpt[c]++; for(l=0;l我想只需要添加 int[] cpt = new int[3]; for (l = 0; l <= 5; l++) for (c = 0; c <= 2; c++

我需要做一个矩阵6x3,显示每列有多少奇数。这就是我的老师教我做的

for (l = 0; l <= 5; l++)
    for (c = 0; c <= 2; c++)
        if (notes[l, c] % 2 != 0)
            cpt[c]++;

for(l=0;l我想只需要添加

int[] cpt = new int[3];
for (l = 0; l <= 5; l++)
    for (c = 0; c <= 2; c++)
        if (notes[l, c] % 2 != 0)
            cpt[c]++;

Console.WriteLine("---------------------");
foreach (var icpt in cpt)
{
    Console.Write("{0,3}   ", icpt);
}
int[]cpt=newint[3];

对于(l=0;l)如果这是他让你做的,你有很好的理由感到困惑。他需要完整地阅读代码,并开始使用有意义的变量名称。还有,“notes”和“cpt”是什么?也可以在控制台应用程序thx中使用它!我应该在代码的哪一部分添加它?
int[] cpt = new int[3];
for (l = 0; l <= 5; l++)
    for (c = 0; c <= 2; c++)
        if (notes[l, c] % 2 != 0)
            cpt[c]++;

Console.WriteLine("---------------------");
foreach (var icpt in cpt)
{
    Console.Write("{0,3}   ", icpt);
}
for (int col = 0; col <= notes.GetUpperBound(1); col++)