Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Even Number Collector | Getting Started with Loops
Java Loops

bookChallenge: Even Number Collector

Opgave

Swipe to start coding

Calculate the total expenses from a list of daily expenses using a for loop.

  1. Create a variable named total and set it to 0.0 — this will store the running sum of expenses.
  2. Use a for loop to go through each element in the expenses array.
  3. In each iteration, add the current expense to total.
  4. After the loop finishes, return the total value.

Løsning

solution.java

solution.java

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 4
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

close

Awesome!

Completion rate improved to 9.09

bookChallenge: Even Number Collector

Stryg for at vise menuen

Opgave

Swipe to start coding

Calculate the total expenses from a list of daily expenses using a for loop.

  1. Create a variable named total and set it to 0.0 — this will store the running sum of expenses.
  2. Use a for loop to go through each element in the expenses array.
  3. In each iteration, add the current expense to total.
  4. After the loop finishes, return the total value.

Løsning

solution.java

solution.java

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 4
single

single

some-alt