TEMA
Why i am getting Runtime error ???
Nir Rifat preguntado 2 years ago
HELP!!!!!
I'm submitting Problem 1190 in java and getting runtime error .. What's wrong with the code?? Here is my code ::
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int c = 0, c1 = 11, c2 = 11;
char ch = in.next().charAt(0);
double[][] arr = new double[12][12];
for (int i = 0; i < 12; i++) {
for (int j = 0; j < 12; j++) {
arr[i][j] = in.nextDouble();
}
}
double s = 0.0;
for (int i = 1; i <= 10; i++) {
for (int j = c1; j >= c2; j--) {
s += arr[i][j];
c++;
}
if (i<5) {
c2--;
}
else if (i>5) {
c2++;
}
}
if (ch == 'S') {
System.out.printf("%.1f\n", s);
} else if(ch == 'M') {
System.out.printf("%.1f\n", s / c);
}
}
}
Este tema fue resuelto y no puede recibir nuevas respuestas.