← Back to Arrays
Question 223
Average of Test Scores
Average of Test Scores
This task combines two ideas: summing an array and then dividing to get an average. First add all the scores into an integer total. Then divide that total by the number of scores, but cast one side to double so you get a decimal result instead of whole-number (integer) division. Print 'Average: ' followed by the average rounded to two decimal places using the %.2f format specifier.Expected Output:
Average: 80.40= newline. No newline after the last line.
Hints4 available
Sign in to use hintsTopics:
Arrays
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.