Created
July 28, 2016 15:27
-
-
Save totynho/4d2287635ee6c25eae70d7ea9c56f125 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pacote; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
String operacao = ""; | |
double m[][] = new double[12][12]; | |
Scanner entrada = new Scanner(System.in); | |
double auxiliar = 0; | |
int espaco = 1; | |
operacao = entrada.nextLine(); | |
for (int linha = 0; linha < 12; linha++){ | |
for (int coluna = 0; coluna < 12; coluna++){ | |
m[linha][coluna] = entrada.nextDouble(); | |
} | |
} | |
for (int coluna= 11; coluna > 6; coluna--){ | |
for (int linha = (0+espaco); linha < (12-espaco); linha++){ | |
auxiliar += m[linha][coluna]; | |
} | |
espaco++; | |
} | |
switch (operacao) { | |
case "S": | |
System.out.println(auxiliar); | |
break; | |
case "M": | |
auxiliar = auxiliar /30; | |
System.out.println(auxiliar); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment