Loop Execution Flow
📖 Scenario: You are helping a small shop owner keep track of daily sales. Each day, the shop records the number of items sold. You want to calculate the total items sold over a week.
🎯 Goal: Build a program that uses a for loop to add up daily sales and show the total items sold in the week.
📋 What You'll Learn
Create an array with daily sales numbers for 7 days
Create a variable to hold the total sales starting at 0
Use a
for loop to add each day's sales to the totalPrint the total sales after the loop finishes
💡 Why This Matters
🌍 Real World
Shops and businesses often need to add up daily sales or counts to understand their performance over time.
💼 Career
Knowing how to use loops to process lists of data is a key skill for many programming jobs, especially in data processing and automation.
Progress0 / 4 steps