Abschnitt 1. Kapitel 48
single
Challenge: Multi-Dimensional Arrays
Swipe um das Menü anzuzeigen
Aufgabe
Wischen, um mit dem Codieren zu beginnen
A classroom has several rows of students, and each student has a score. You need to calculate the total score for each row using a method that accepts a 2D array.
- Use
array.GetLength(0)to get the number of rows. - Use
array.GetLength(1)to get the number of columns. - Initialize a variable
rowTotal = 0for each row before summing. - Use
rowTotal += scores[row, col]to add each student's score. - Print the row total using
Console.WriteLine.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 1. Kapitel 48
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen