Sektion 1. Kapitel 25
single
Challenge: Matrix Sum
Stryg for at vise menuen
Opgave
Swipe to start coding
Write a program that calculates the sum of all elements in a 2D integer array and prints the result.
- Iterate through each row of the
matrixparameter. - For each row, iterate through each column.
- Add each element to a running total.
- Return the total sum.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 1. Kapitel 25
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat