/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package listaexercicios;

/**
 *
 * @author awolf
 */
public class Questao25 {

    public static double calcMedia(int v[]) {
        double soma = 0.0;
        for (int i = 0; i < v.length; i++) {
            soma = soma + v[i];
        }
        return soma / v.length;
    }

    public static void main(String[] args) {
        int vetDados[] = new int[30];
        for (int i = 0; i < 30; i++) {
            vetDados[i] = (int) (Math.random() * 10);
        }

        double media = calcMedia(vetDados);

        int vetAux[] = new int[30]; // para garantir usamos 30 (maximo)
        int cont = 0;
        for (int i = 0; i < 30; i++) {
            int valor = vetDados[i];
            if (valor > media) {
                if (!Questao33.buscaVetor(vetAux, valor)) {
                    vetAux[cont] = valor;
                    cont = cont + 1;
                }
            }
        }

        for (int i = 0; i < cont; i++) {
            System.out.println(vetAux[i]);
        }

    }

}
