Faça um programa em C que receba uma sequência de números naturais e exiba todos os elementos que são maiores que a média aritmética desta sequência. Considere que a média aritmética é calculada da seguinte maneira:
Considere também que é um número inteiro. Caso não haja na sequência nenhum elemento maior que , exiba o número .
A primeira linha da entrada contém um inteiro significando o tamanho do vetor. A segunda linha possui números inteiros positivos , onde cada é um elemento do vetor.
Considere as seguintes restrições para os valores de entrada:
A saída é composta por exatamente uma linha, contendo todos os elementos que são maiores do que a média da sequência, onde cada elemento deve ser separado por espaço, com exceção do último. Caso não haja elementos maiores que a média, deve ser impresso em uma única linha o número .
Observe os casos de exemplos para melhor entendimento da saída.
Há elementos neste vetor. A média aritmética desta sequência será:
O segundo, terceiro, sexto, nono e décimo elementos são maiores que a média. O segundo elemento é o número , o terceiro o , o sexto o , o nono o e o décimo .
Write a C program that, given a sequence of natural number, show all elements bigger than the arithmetic mean of this sequence. Consider that the arithmetic mean is calculated as following: Consider also that the is an integer number. If there is no element bigger than , show the number .
The first entry line contains an integer number meaning the length of the array. The second entry line contains positive integers numbers , that each is an element from the array. Check the restrictions for the input:
Your program must show one line for the output, showing the elements that are bigger than the mean of the sequence, where each element must be split by space except the last one. If there is no elements bigger than the average, your program must show a single line with the number on it.
Check the example below for better understanding of the output.
There is element in this array. The arithmetic mean of this sequence will be: The second, third, sixth, ninth and tenth elements are bigger than the mean. The second element is the number , the third is , the sixth is , the ninth is and the tenth is .
Author: Sinayra Moreira <sinayra.moreira@unb.br>