import java.util.* ;
class Main {
public static void main
( String [ ] args
) { Scanner ler
= new Scanner
( System .
in ) ; System .
out .
println ( "Informe a quantidade de numeros a serem listados." ) ; int cp = ler.nextInt ( ) ;
int contPar = 0 , contImpar = 0 ;
int somaPar = 0 , somaImpar = 0 ;
for ( int i = 0 ; i < cp; i++ ) {
System .
out .
println ( "Digite o " + ( i
+ 1 ) + "° numero: \n " ) ; int num = ler.nextInt ( ) ;
if ( num % 3 == 0 && num % 5 == 0 ) {
System .
out .
println ( "Este numero é divisivel por 3 e 5." ) ; }
if ( num % 2 == 0 ) {
System .
out .
println ( "Este numero é PAR." ) ; contPar++;
somaPar += num;
} else {
System .
out .
println ( "Este numero é IMPAR." ) ; contImpar++;
somaImpar += num;
}
}
System .
out .
println ( "A media dos numeros PARES é : " + ( float ) somaPar
/ contPar
) ; System .
out .
println ( "A media dos numeros IMPARES é : " + ( float ) somaImpar
/ contImpar
) ; }
}
//https://pt.stackoverflow.com/q/242752/101
aW1wb3J0IGphdmEudXRpbC4qOwoKY2xhc3MgTWFpbiB7CiAgICBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKSB7CiAgICAgICAgU2Nhbm5lciBsZXIgPSBuZXcgU2Nhbm5lcihTeXN0ZW0uaW4pOwogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiSW5mb3JtZSBhIHF1YW50aWRhZGUgZGUgbnVtZXJvcyBhIHNlcmVtIGxpc3RhZG9zLiIpOwogICAgICAgIGludCBjcCA9IGxlci5uZXh0SW50KCk7CiAgICAgICAgaW50IGNvbnRQYXIgPSAwLCBjb250SW1wYXIgPSAwOwogICAgICAgIGludCBzb21hUGFyID0gMCwgc29tYUltcGFyID0gMDsKICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNwOyBpKyspIHsKICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJEaWdpdGUgbyAiICsgKGkgKyAxKSArICLCsCBudW1lcm86IFxuIik7CiAgICAgICAgICAgIGludCBudW0gPSBsZXIubmV4dEludCgpOwogICAgICAgICAgICBpZiAobnVtICUgMyA9PSAwICYmIG51bSAlIDUgPT0gMCkgewogICAgICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJFc3RlIG51bWVybyDDqSBkaXZpc2l2ZWwgcG9yIDMgZSA1LiIpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChudW0gJSAyID09IDApIHsKICAgICAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiRXN0ZSBudW1lcm8gw6kgUEFSLiIpOwogICAgICAgICAgICAgICAgY29udFBhcisrOwogICAgICAgICAgICAgICAgc29tYVBhciArPSBudW07CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIkVzdGUgbnVtZXJvIMOpIElNUEFSLiIpOwogICAgICAgICAgICAgICAgY29udEltcGFyKys7CiAgICAgICAgICAgICAgICBzb21hSW1wYXIgKz0gbnVtOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiQSBtZWRpYSBkb3MgbnVtZXJvcyBQQVJFUyDDqSA6ICIgKyAoZmxvYXQpc29tYVBhciAvIGNvbnRQYXIpOwogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiQSBtZWRpYSBkb3MgbnVtZXJvcyBJTVBBUkVTIMOpIDogIiArIChmbG9hdClzb21hSW1wYXIgLyBjb250SW1wYXIpOwogICAgfQp9CgovL2h0dHBzOi8vcHQuc3RhY2tvdmVyZmxvdy5jb20vcS8yNDI3NTIvMTAx