โ 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: 2 (the average is6.2, and8and11are above it). Print only the number and a newline.
Expected Output:
2
Topics:
Arrays
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.