Common array operations
📖 Scenario: You are working on a simple inventory system for a small store. The store keeps track of the quantities of three products in an array.
🎯 Goal: You will create an array to hold product quantities, set a threshold for low stock, find which products are low in stock, and print those products.
📋 What You'll Learn
Create an integer array called
quantities with values 10, 5, and 2Create an integer variable called
lowStockThreshold and set it to 5Use a
for loop with variable i to find indices of products with quantity less than lowStockThreshold and store these indices in an integer list called lowStockProductsPrint the
lowStockProducts list💡 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
