← Back to Arrays
Question 424
Count Elements Greater Than the Average
Count Elements Greater Than the Average
An arrayint nums[] = {2, 4, 6, 8, 11}is given. First compute the average of all elements as adouble, then count how many elements are strictly greater than that average and print the count (see Expected Output). (the average is6.2, and8and11are above it). Print only the number and a newline.
Expected Output:
2= newline. The output ends with a newline — print one 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 (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.