Challenge: Array Loops
Opgave
Swipe to start coding
Your task is to calculate the total sales for a set of days using a method.
- Create a method
CalculateTotalSalesthat:- Accepts an array of
doublevalues representing daily sales. - Uses a for loop to iterate through the array.
- Calculates the total sum of all sales.
- Returns the total as a
double.
- Accepts an array of
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 5. Kapitel 6
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
Fantastisk!
Completion rate forbedret til 1.25
Challenge: Array Loops
Stryg for at vise menuen
Opgave
Swipe to start coding
Your task is to calculate the total sales for a set of days using a method.
- Create a method
CalculateTotalSalesthat:- Accepts an array of
doublevalues representing daily sales. - Uses a for loop to iterate through the array.
- Calculates the total sum of all sales.
- Returns the total as a
double.
- Accepts an array of
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 5. Kapitel 6
single