006-001-001

Arrays: Array Statistics

Medium

Problem Description

In this problem, you will create a program that reads the number of elements N and each integer, calculates their sum and average, and displays the result to standard output.

Problem Overview

Create a program that inputs the array size and elements, then calculates sum and average.

Input Format

Line 1: Number of elements N
Following lines: N integers (one per line)

Output Format

Output in the following format:

Count: [count]
Sum: [sum]
Average: [average]
```java

Display average with up to 2 decimal places if it contains decimals.

Test Cases

※ Output examples follow programming industry standards

Normal case
Input:
3
10
20
30
Expected Output:
Count: 3
Sum: 60
Average: 20.00
Normal case
Input:
4
1
2
3
4
Expected Output:
Count: 4
Sum: 10
Average: 2.50

Your Solution

Current Mode: My Code
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 10 free executions remaining