asd
asdunknown
csharp
a year ago
694 B
3
Indexable
Never
// i initialize 2 dimensional array int[,] zweidimensionalesArray = new int[,] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; // i initialize 2 variables with values of row and column length int zeilen = zweidimensionalesArray.GetLength(0); int spalten = zweidimensionalesArray.GetLength(1); // for-loop to increment columns for (int j = 0; j < spalten; j++) { int spaltenSum = 0; // initializing result sum of each column value for (int i = 0; i < zeilen; i++) // for-loop to increment rows { spaltenSum += zweidimensionalesArray[i, j]; // adds value to current column } Console.WriteLine("Sum of column " + j + ": " + spaltenSum); }