CJCoding With Joseph
15free / daySign inCreate account

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 (see Expected Output).

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