import java.util.Scanner;
class Media {
public static void main
(String[] args
) { float acumulador = 0;
int contador = 0;
Scanner scanner
= new Scanner
(System.
in); while (true) {
System.
out.
println("Insira um valor: "); String dado
= scanner.
nextLine(); if (dado.equals("N")) {
break;
}
try {
float valor
= Float.
parseFloat(dado
); contador++;
acumulador += valor;
System.
out.
println("Valor inválido digite um válido"); }
}
System.
out.
println("Média: "+ acumulador
/ contador
); }
}
aW1wb3J0IGphdmEudXRpbC5TY2FubmVyOwoKY2xhc3MgTWVkaWEgewogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewogICAgICAgIGZsb2F0IGFjdW11bGFkb3IgPSAwOwogICAgICAgIGludCBjb250YWRvciA9IDA7CiAgICAgICAgU2Nhbm5lciBzY2FubmVyID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKICAgICAgICB3aGlsZSAodHJ1ZSkgewogICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIkluc2lyYSB1bSB2YWxvcjogIik7CiAgICAgICAgICAgIFN0cmluZyBkYWRvID0gc2Nhbm5lci5uZXh0TGluZSgpOwogICAgICAgICAgICBpZiAoZGFkby5lcXVhbHMoIk4iKSkgewogICAgICAgICAgICAJYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgCWZsb2F0IHZhbG9yID0gRmxvYXQucGFyc2VGbG9hdChkYWRvKTsKICAgICAgICAgICAgICAgIGNvbnRhZG9yKys7CiAgICAgICAgICAgICAgICBhY3VtdWxhZG9yICs9IHZhbG9yOwogICAgICAgICAgICB9IGNhdGNoIChOdW1iZXJGb3JtYXRFeGNlcHRpb24gZXgpIHsKICAgICAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiVmFsb3IgaW52w6FsaWRvIGRpZ2l0ZSB1bSB2w6FsaWRvIik7CiAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiTcOpZGlhOiAiKyBhY3VtdWxhZG9yIC8gY29udGFkb3IpOwogICAgfQp9