Compute student scores using 3D array

Why is it not starting with 1 after changing int i=1 in for loop i want to list students score from 1-7 rather than 0-6

Yes i know it's in java but i am having problems understanding it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  public static void main(String args[]){
        
          double[][][] marks = {{{7.5, 20.5}, {12, 22.5}, {22, 33.5}, {43, 21.5}, {15, 2.5}},
                                 {{4.5, 21.5}, {12, 22.5}, {12, 34.5}, {12, 20.5}, {14, 9.5}},
                                 {{5.5, 30.5}, {9.4, 2.5}, {13, 33.5}, {11, 23.5}, {16, 2.5}},
                                 {{6.5, 23.5}, {9.4, 32.5}, {13, 34.5}, {11, 20.5}, {16, 7.5}},
                                 {{8.5, 25.5}, {9.4, 52.5}, {13, 36.5}, {13, 24.5}, {16, 2.5}},
                                 {{9.5, 20.5}, {9.4, 42.5}, {13, 31.5}, {12, 20.5}, {16, 6.5}},
                                 {{1.5, 29.5}, {9.4, 22.5}, {19, 30.5}, {10, 30.5}, {19, 5.6}}};
double n = 0.0;

for (int i = 1; i <= 7; i++)
    
            {
for (int j = 0; j < 5; j++)
                {
for (int k = 0; k < 2; k++)
                    {
                        n = n + marks[i] [j] [k];
                    }
                }
                
System.out.println("Student " + i + " Got " + n + " marks");
                n = 0.0;  }   
} 
Topic archived. No new replies allowed.