#C13544. Elements Greater Than Average
Elements Greater Than Average
Elements Greater Than Average
Given an array of numbers, your task is to find and output all the elements that are strictly greater than the average of the array. The average is defined as \(\text{average} = \frac{\text{sum of all elements}}{\text{number of elements}}\). If the array is empty, you should output the error message "Error: The array is empty.".
The input will be provided via standard input (stdin), and your program should write the result to standard output (stdout). If no element is greater than the average, output an empty line.
Note: When printing numbers, if a number is mathematically an integer (for example, 4.0), print it as an integer (i.e. 4) rather than with a decimal point.
inputFormat
The first line contains an integer \(n\) which represents the number of elements in the array. The second line contains \(n\) space-separated numbers, which can be integers or floating-point values.
outputFormat
If \(n = 0\), output the following exact error message: "Error: The array is empty." Otherwise, output the elements from the array that are strictly greater than the computed average, separated by a single space. If no element qualifies, output an empty line.
## sample5
1 2 3 4 5
4 5