The problem is that every time I enter an if created I must delete the floating variable where I store information, only that information is every 3 months and I get information every 12 months, which requires is that when I enter the if it means that it is a quarter, for which I must do the quarterly calculation and before leaving delete the variable so that when I re-enter it does not contain information from previous months.
All right up there, because if you do that procedure for about 6 or 7 iterations, but then it goes bankrupt and tells me error.
private string[] naciones;
private float[] media;
private float[,] mediaT;
private float[,] mensual;
private string linea;
private int cantidad;
private float mediaM=0.0f;
private float mediaTr = 0.0f;
private int z = 0;
public void cargar()
{
Console.WriteLine("Ingrese la cantidad de paises");
linea = Console.ReadLine();
cantidad = int.Parse(linea);
naciones=new string[cantidad];
mensual=new float[cantidad,12];
media=new float[cantidad];
mediaT = new float[cantidad,4];
for (int x = 0; x < naciones.Length;x++ )
{
Console.WriteLine("Ingrese el nombre del pais");
naciones[x] = Console.ReadLine();
for (int y = 0; y < mensual.GetLength(1);y++ )
{
Console.WriteLine("Ingrese La temperatura");
linea = Console.ReadLine();
mensual[x, y] = float.Parse(linea);
mediaM=mediaM+float.Parse(linea);
mediaTr = mediaTr + float.Parse(linea);
if (y==2 || y==5 || y==8 || y==11) {
Console.WriteLine("ENTRO");
z = z + 1;
mediaTr = mediaTr / 3;
mediaT[x, z] = mediaTr;
mediaTr = 0.0f; ----> ERROR
}
}
media[x] = mediaM / 12;
}
}