# Answer to Question #5088 in C++ for aiman

Question #5088

how to calculate average temperature of a year including the index by using arrays 2-dimensional

Expert's answer

create 2-dimensional array, where first - day in month and second - day in month

and fill with its values.

float ar[31][12];

then calculate average

temperature:

for (int i=0;i<31;i++){

for (int

j=0;j<12;j++){

Sum=Sum+ar[i,j];

k++;

}

}

average=Sum/k;

and fill with its values.

float ar[31][12];

then calculate average

temperature:

for (int i=0;i<31;i++){

for (int

j=0;j<12;j++){

Sum=Sum+ar[i,j];

k++;

}

}

average=Sum/k;

## Comments

## Leave a comment