CJCoding With Joseph
15free / daySign inCreate account

Five Numbers from Input

Write a program that reads exactly five integers from standard input (separated by spaces or newlines) into an array<int, 5>, then prints their sum and their average.

Print two lines: the word Sum:, a space and the sum as an integer, then the word Average:, a space and the average (sum divided by 5.0) with exactly one decimal place using fixed and setprecision(1) from <iomanip>.

Example input:
1 2 3 4 5

The output for that input is shown in Expected Output.

Expected Output:

Sum: 15
Average: 3.0
Sum: 23
Average: 4.6

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
STL Containersstd::array
📥 Auto-Input:
1 2 3 4 5\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.