CJCoding With Joseph

Count Elements Greater Than the Average

An array int nums[] = {2, 4, 6, 8, 11} is given. First compute the average of all elements as a double, then count how many elements are strictly greater than that average and print the count:

2

(the average is 6.2, and 8 and 11 are 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.