Array initialization
📖 Scenario: You are working on a simple inventory system for a small store. You need to keep track of the quantity of five different products.
🎯 Goal: Create an array to store the quantities of five products, set a threshold for low stock, find which products are below this threshold, and print their quantities.
📋 What You'll Learn
Create an array called
quantities with exactly five integer values: 10, 3, 7, 2, 5Create an integer variable called
lowStockThreshold and set it to 4Use a
for loop with index i to check each quantity in quantitiesCreate a new array called
lowStock to store quantities below the thresholdPrint the
lowStock array💡 Why This Matters
🌍 Real World
Stores and warehouses often track product quantities to know when to reorder items.
💼 Career
Understanding arrays and loops is essential for managing collections of data in software development.
Progress0 / 4 steps