Challenge: Even Number Collector
Task
Swipe to start coding
Calculate the total expenses from a list of daily expenses using a for loop.
- Create a variable named
totaland set it to0.0β this will store the running sum of expenses. - Use a for loop to go through each element in the
expensesarray. - In each iteration, add the current expense to
total. - After the loop finishes, return the
totalvalue.
Solution
solution.java
Everything was clear?
Thanks for your feedback!
SectionΒ 1. ChapterΒ 4
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Suggested prompts:
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Awesome!
Completion rate improved to 9.09
Challenge: Even Number Collector
Swipe to show menu
Task
Swipe to start coding
Calculate the total expenses from a list of daily expenses using a for loop.
- Create a variable named
totaland set it to0.0β this will store the running sum of expenses. - Use a for loop to go through each element in the
expensesarray. - In each iteration, add the current expense to
total. - After the loop finishes, return the
totalvalue.
Solution
solution.java
Everything was clear?
Thanks for your feedback!
SectionΒ 1. ChapterΒ 4
single