004-007-003
Array Length: Inventory Count
Easy
Problem Description
Array Length: Inventory Count
Learning Objective: Get array element count using length property
Manage product inventory. Use array's length property to get element count.
Input
Line 1: Number of products (integer)
Following lines: Stock count for each product (integer, one per line)
Output
Products: [count]
Total stock: [sum] items
Test Cases
※ Output examples follow programming industry standards
Input:
3 10 20 30
Expected Output:
Products: 3 Total stock: 60 items
Input:
5 5 10 15 20 25
Expected Output:
Products: 5 Total stock: 75 items
Input:
1 100
Expected Output:
Products: 1 Total stock: 100 items
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here
sc.close();
}
}
0 B / 5 MB
You have 5 free executions remaining
