Skip to content

Instantly share code, notes, and snippets.

@totynho
Created July 28, 2016 16:18
Show Gist options
  • Save totynho/a6c60e4f4ad645ff58909059ef58c7f4 to your computer and use it in GitHub Desktop.
Save totynho/a6c60e4f4ad645ff58909059ef58c7f4 to your computer and use it in GitHub Desktop.
package javaapplication;
import java.util.Scanner;
public class JavaApplication {
public static void main(String[] args) {
String fazer = "";
double tabela[][] = new double[12][12];
Scanner entrada = new Scanner(System.in);
double auxiliar = 0;
int branco = 1;
fazer = entrada.nextLine();
for (int linha = 0; linha < 12; linha++){
for (int coluna = 0; coluna < 12; coluna++){
tabela[linha][coluna] = entrada.nextDouble();
}
}
for (int coluna= 11; coluna > 6; coluna--){
for (int linha = (0+branco); linha < (12-branco); linha++){
auxiliar = auxiliar + tabela[linha][coluna];
}
branco++;
}
switch (fazer) {
case "S":
System.out.println(auxiliar);
break;
case "M":
double media = auxiliar /30;
System.out.println(media);
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment