Array Declaration and Initialization
📖 Scenario: You are helping a small grocery store keep track of the number of apples sold each day for a week.
🎯 Goal: Create an array to store the number of apples sold each day, then print the array to see the sales for the week.
📋 What You'll Learn
Create an array called
apples_sold with 7 elements representing daily salesInitialize the array with these exact values: 5, 8, 6, 7, 10, 4, 9
Create a variable called
days and set it to 7Use a
for loop with variable i from 0 to days - 1 to print each day's salesPrint the sales in the format:
Day 1: 5 apples💡 Why This Matters
🌍 Real World
Arrays are used to store fixed-size collections of data, like daily sales, temperatures, or scores.
💼 Career
Understanding arrays and loops is essential for software development, data analysis, and many programming tasks.
Progress0 / 4 steps
