TOPIC

onde estou errando?

Higor Augusto asked 1 month ago

Scanner scanner = new Scanner(System.in); DecimalFormat df = new DecimalFormat("0.0");

double m[][] = new double[3][3];
int l;

String op;
l = Integer.parseInt(scanner.nextLine());
op = scanner.nextLine();

float soma = 0,somaMedia = 0;

 for (int linha = 0; linha < m.length; linha++) {
     for (int coluna = 0; coluna < m[linha].length; coluna++) {
    m[linha][coluna] = scanner.nextFloat();
}
}   

for (int linha = 0; linha < 12; linha++) {
    soma += m[l][linha];
}

somaMedia = soma / 12;
if (op.equals("S")) {

    System.out.printf(df.format(soma));
}else if(op.equals("M")){

    System.out.printf(df.format(somaMedia));

}
System.out.println();

} }

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.